UVA1482:Playing With Stones(SG)

Sample Output

NO YES NO YES打表找规律得出SG表#include <iostream>#include <stdio.h>#include <string.h>#include <stack>#include <queue>#include <map>#include <set>#include <vector>#include <math.h>#include <bitset>#include <algorithm>#include <climits>using namespace std;#define LS 2*i#define RS 2*i+1#define UP(i,x,y) for(i=x;i<=y;i++)#define DOWN(i,x,y) for(i=x;i>=y;i–)#define MEM(a,x) memset(a,x,sizeof(a))#define W(a) while(a)#define gcd(a,b) __gcd(a,b)#define LL long long#define N 1000005#define MOD 1000000007#define INF 0x3f3f3f3f#define EXP 1e-8LL SG(LL x){if(x&1)return SG(x/2);return x/2;}int main(){int n,t,i,j;LL a,ans;scanf("%d",&t);while(t–){ans = 0;scanf("%d",&n);for(i = 0; i<n; i++){scanf("%lld",&a);ans^=SG(a);}if(ans) printf("YES\n");else printf("NO\n");}return 0;}

,因为冲动会做下让自己无法挽回的事情。

UVA1482:Playing With Stones(SG)

相关文章:

你感兴趣的文章:

标签云: