10 29

  Decadent several days should write a blog, after all, some topics still very good, the key is to always push dp not come out as expected or I was too dishes.

Today's test is the quality of the cattle off the race was okay but expected the actual score 220 points 180 / cy lot of various gods AK collapse dp push out the graph theory can not write very self-closing anyway ... T1 100 T2 40 T3 40

This question is very interesting game problems more typical of the situation and consider the different requirements SG function for a number of different stones situation has nothing to chart a careful analysis of every game situation.

1 to 2 innings to win for losing Bureau for losing 3 innings ... seems to be no law considered separately even-even and odd point of view we are always close to FLAC found that only men can not take the upper hand so the even losing the upper hand situation.

Consider the situation odd number greater than 1 in a first step FLAC alongside, just get the upper hand this time the first step of chess has two positions can not continue under only one hand and then stuck to his men after the next location can not be found or the upper hand despite the defeat of the next multi-position can be the first step backwards but a position similar to the even formation of the situation at this time or just get the first down.

So get this situation SG function in addition to all the remaining 1 situation is 0 then seek a directed graph and the game can be.

// single situation even-losing
 // think of a single situation in addition to the remaining 1 is doomed to failure directly XOR good
 // #include <bits / STDC ++. H> 
#include <iomanip> 
#include <iostream> 
#include <cstdio> 
#include <CString> 
#include < String > 
#include <Queue> 
#include <the deque> 
#include <the cmath> 
#include <the ctime> 
#include <the cstdlib> 
#include <Stack> 
#include <algorithm> 
#include <Vector> 
#include <the cctype> 
#include <Utility>
#include<set>
#include<bitset>
#include<map>
#define INF 1000000000
#define ll long long
#define min(x,y) ((x)>(y)?(y):(x))
#define max(x,y) ((x)>(y)?(x):(y))
#define RI register ll
#define db double
#define pii pair<ll,ll>
#define mk make_pair
using namespace std;
char *fs,*ft,buf[1<<15];
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline int read()
{
    int x=0,f=1;char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getc();}
    return x*f;
}
int T;
int n,ans;
int main()
{
    T=read();
    while(T--)
    {
        ans=0;
        n=read();
        for(int i=1;i<=n;++i)
        {
            int x=read();
            if(x==1)ans^=1;
        }
        if(ans)puts("rabbit");
        else puts("hamster");
    }
    return 0;
}
View Code

 

Guess you like

Origin www.cnblogs.com/chdy/p/11768825.html