1#include <iostream>2#include <cstdio>3#include <cstring>4#include <vector>5#include <algorithm>6 using namespacestd;7typedefLong Longll;8 9 /*Ten official: One Ample heap: The number of stones is greater than or equal to 2 =1 represents a solitary heap A - singular situation, all heaps of XOR and ==0. - the non-singular situation: S0, ample heap of 0; - S1, ample heap for 1 - S2, ample heap of >=2 - + a singular situation; a T0, a heap of 0; - T2, ample pile for >=2; + PS: Ample heap for 1: All heap xor! = 0 A State Transitions at S0, will defeat, T0 win - S1, Win-----> S1->s0 - - ***** - S2 win, T2 will fail. - 1) T2 can only be transferred to S1 and S2-----> or the state must change in 2) If the T2 transfer to S1 T2 defeat, if the T2 transfer to S2,S2 only need to turn back to T2. So S2 wins, T2 defeat. - Strange situation: There will be no conversion back to the situation: to For example 2 3 (not singular situation)---> 2 2-----> + - the so: * win State: T0,s1,s2 $ must-fail state: S0,t2Panax Notoginseng - as long as there's plenty of 0 cleanup. the */ + intMain () { A the intT; +scanf"%d",&T); - while(t--){ $ intn,tmp, x =0; $ BOOLf =true; -scanf"%d",&n); - for(inti =0; I < n; i + +){ thescanf"%d",&tmp); -X ^=tmp;Wuyi if(TMP! =1) F =false; the } - if(f) { Wu if(n&1) puts ("meidikeji_shijiediyi!"); - ElsePuts"yamato_saikou!"); About}Else{ $ if(x) puts ("yamato_saikou!"); - ElsePuts"meidikeji_shijiediyi!"); - } - A } + the}
Nanjing University Eighth annual Program Design Competition (off-campus mirror) H who is the strongest battleship!