poj3372

poj3372 View Code
   
     
#include < cstdio >
#include
< iostream >
#include
< cstdlib >
#include
< cstring >
using namespace std;

int main()
{
// freopen("D:\\t.txt", "r", stdin);
int n;
while (scanf( " %d " , & n) != EOF)
{
while (n % 2 == 0 )
n
/= 2 ;
if (n == 1 )
printf(
" YES\n " );
else
printf(
" NO\n " );
}
return 0 ;
}

这是一个复杂的数学问题,但是可以通过小数据猜测出来,最后发现只要是2的幂就行,否则不行。

你可能感兴趣的:(poj)