Codeforces Round 765 (Div. 2)
A. Ancient Civilization
好像就是
void solve(){
int n=read(),m=read();
vector<int>cnt0(m+1),cnt1(m+1);
for(int i=1;i<=n;i++){
int x=read();
for(int j=m;j>=1;j--){
if(x%2)cnt1[j]++;
else cnt0[j]++;
x/=2;
}
}
int ans=0;
for(int j=1;j<=m;j++){
if(cnt1[j]>cnt0[j])ans=ans*2+1;
else ans*=2;
}
cout<<ans<<'\n';
//puts(ans>0?"YES":"NO");
//puts(ans>0?"Yes":"No");
}
B. Elementary Particles
C. Road Optimization
D. Binary Spiders
E1. Cats on the Upgrade (easy version)
E2. Cats on the Upgrade (hard version)
标签:测试,int,else,read,version,cnt1,ans From: https://www.cnblogs.com/edgrass/p/17633771.html