Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jianminchen
Created December 28, 2016 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jianminchen/7b9b2a8ebab53b39e5df2a410069d519 to your computer and use it in GitHub Desktop.
Save jianminchen/7b9b2a8ebab53b39e5df2a410069d519 to your computer and use it in GitHub Desktop.
week code 27 - zerom nim sum
#include <iostream>
#include <cassert>
#include <cstdio>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <time.h>
#include <set>
#define ll long long
using namespace std;
int main() {
int T;
cin>>T;
for(int t=1;t<=T;t++) {
int n;
cin>>n;
int g=0;
for(int i=0;i<n;i++) {
int x;
cin>>x;
if (x&1) {
g ^= (x+1);
} else {
g ^= (x-1);
}
}
if (g==0)
printf("L\n");
else
printf("W\n");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment