提交时间:2020-08-23 19:34:26

运行 ID: 6092

#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; } }