cswork / OA打开练习工作台

Valkyrie TradingOA #4

Is Power of 2

简单可在线判题

考点(AI 标注)位运算

Given an integer n, return 1 if n is a non-negative integer power of 2, otherwise return 0. In the example, 1=2⁰, so 1 is a power of 2.

This site adds the standard input/output protocol.

输入格式

Input a signed 32-bit integer n (−2^31≤n≤2^31−1); the range is filled in according to the int type in the original function signature.

输出格式

Output 1 or 0.

样例 1

输入:

1

输出:

1

样例 2

输入:

2

输出:

1

样例 3

输入:

3

输出:

0