Nanjing University Eighth annual Program Design Competition (off-campus mirror) H who is the strongest battleship!

Source: Internet
Author: User

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.