Playing With Stones UVALive

Code:

#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll SG(ll i){
    return i % 2 ==0 ? i / 2 : SG(i/2);
}
ll arr[100000];
int main(){
    //freopen("input.in","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        int n;
        ll sum=0;
        scanf("%d",&n);
        for(int i=1;i<=n;++i) {
            ll a;
            scanf("%lld",&a);
            sum^=SG(a);
        }
        if(sum==0) printf("NO
");
        else printf("YES
");
    }
    return 0;
}

  

原文地址:https://www.cnblogs.com/guangheli/p/9912486.html