ZJNU 1538 - YN ngC take sub-games! - Advanced

Nim Game

Since moving to the 0th order will disappear

It can be obtained necessarily all of the first order sub-move all operations from the last person to 0th

Recursive available, it can last odd order to move the child who will win even order

So this win condition is that the child on the odd-order all 0

Take the odd-order the game to be Nim

 1 #include<stdio.h>
 2 int main(){
 3     int n,i,a,s=0;
 4     scanf("%d",&n);
 5     for(i=1;i<=n;i++){
 6         scanf("%d",&a);
 7         if(i%2==1)
 8             s^=a;
 9     }
10     puts(s?"YN!ngC":"Albert");
11     
12     return 0;
13 }

 

Guess you like

Origin www.cnblogs.com/stelayuri/p/12236162.html