第一次比赛唯一ACCEPT的题目笑哭


判断一个数是否为2的次方
#include<iostream> #include<cmath> using namespace std; int main() { long long n; bool flag; cin>>n; for(int i=0;i<=32;i++) { if(pow(2,i)==n) cout<<"yes"<<endl; else continue; flag=true; } if(flag==false) cout<<"no"<<endl; return 0; }
#include<iostream>
using namespace std;
int main()
{
  int num;
  cin>>num;
  if(num&(num-1))
    cout<<"no"<<endl;
  else
    cout<<"yes"<<endl;
  return 0;

}
这个是大招哦

做个标记 9&5=1

1001

0101

0001

posted @ 2017-12-10 14:35  李白打野贼帅  阅读(219)  评论(0编辑  收藏  举报