| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
物理课上着上着就想到错哪儿了,别这么低级了啊!!!位运算看不懂的话就看我这个吧。。。#include<iostream>
using namespace std;
int solve(int64 a){
int64 count=0,i=2;
while(i<=a){
count+=a/i;
i=i*2;//这个地方我昨晚写的是i=i*i,小悲剧,害我wa两次
}
return count;
}
int main(){
int64 n,k;
while(cin>>n&&cin>>k){
if(k==0||k==n){
cout<<"1"<<endl;
continue;
}
if(solve(n)==solve(k)+solve(n-k)){
cout<<"1"<<endl;
continue;
}
cout<<"0"<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator