Problem | Result | Memory | Time | Language | Code Length |
2484 | Accepted | 704K | 0MS | G++ | 250B |
#include <iostream>
using namespace std;
//《 挑战程序设计竞赛 》书中例题
int main()
{
while(1)
{
int NUM;
cin>>NUM;
if(NUM==0)
{
break;
}else if((NUM==1)||(NUM==2))
{
cout<<"Alice"<<endl;
}else
{
cout<<"Bob"<<endl;
}
}
return 0;
}
n 枚硬币,排成一圈。Alice 和 Bob 轮流取 1 枚或连续(中间没有空位)的 2 枚。取走最后一枚的获胜,求获胜方。