除了第一个点其他是 WA
代码:
#include<bits/stdc++.h>
using namespace std;
int n;
char f(int x){
int a,b;
while(x){
if((x%2)&1==1) a++;
else b++;
x>>=1;
}
if(a>b) return 'a';
return 'b';
}
int main(){
int a=0,b=0;
cin >> n;
for(int i = 1;i<=n;i++){
if(f(i)=='a')a++;
else b++;
}
cout << a << ' ' << b;
return 0;
}
995 995 995 995 995 995 995 995 995 995 995 995 995 995