那么我们就模拟他们取硬币的过程吧。
希尔(Ciel)的话,100元不小于2个的情况下就取2个加上2个10元的,不足2个就取光剩下的10元来凑
Hanako反之,同理。
自然,当总钱数不足220或者10元硬币不足2个的时候失败。
代码如下:
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
// http://codeforces.com/contest/79
// Bus Game
int main()
{
int x,y,turn=1; //1-Ciel 2-Hanako
cin>>x>>y;
while(turn)
{
if(y<2 || 100*x+10*y<220) break;
if(turn==1)
{
if(x>=2)x-=2,y-=2;
else if(x==1)x-=1,y-=12;
else if(x==0)y-=22;
}
else if(turn==2)
{
if(y>=22)y-=22;
else if(y>=12)y-=12,x-=1;
else if(y>=2)y-=2,x-=2;
}
turn = 3-turn;
}
if(turn==1)printf("Hanako");
else printf("Ciel");
return 0;
}