Wannaflyキャンプ2020日2Cは満足している新しい百石ゲーム

それをブログに送信するには、なぜ、このような素朴な疑問?
私は別のビット算術演算子の優先順位の問題の血を持っていたので、

#include <bits/stdc++.h>
using namespace std;

#define int long long
const int N = 100005;

int n,a[N][62],t[62];

signed main() {
    ios::sync_with_stdio(false);
    cin>>n;
    int sum=0,tmp=0;
    for(int i=1;i<=n;i++) {
        cin>>tmp;
        sum^=tmp;
        for(int j=60;j>=0;--j) t[j]=(sum>>j)&1;
        for(int j=60;j>=0;--j) a[i][j]=a[i-1][j]+((tmp>>j)&1);
        if(sum==0) cout<<0<<endl;
        else {
            int k=60;
            while(t[k]==0) --k;
            cout<<a[i][k]<<endl;
        }
    }
}

おすすめ

転載: www.cnblogs.com/mollnn/p/12232039.html