Run ID Author Problem Lang Verdict Score Time Memory Code Length Submit Time
6092 吴泽宇 统计1和0的个数 C++ Accepted 100 5 MS 256 KB 320 2020-08-23 19:34:26

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int main(){ int a; cin>>a; for(int i=1;i<=a;i++){ int b; cin>>b; int sum1=0,sum0=0; if(b==0){ cout<<0<<" "<<1<<endl; } while(b!=0){ if(b&1){ sum1++; }else{ sum0++; } b>>=1; } cout<<sum1<<" "<<sum0<<endl; } }


Judgement Protocol: