1071 小赌怡情 (15 分)
题目链接
https://pintia.cn/problem-sets/994805260223102976/problems/994805264312549376
题解
注意逻辑:先是游戏结束,再是没有足够的筹码…
#include <bits/stdc++.h>
using namespace std;
int main()
{
int T,K;
int n1,b,t,n2;
scanf("%d%d",&T,&K);
for(int i=0; i<K; i++)
{
scanf("%d%d%d%d",&n1,&b,&t,&n2);
if(T<=0)
{
printf("Game Over.\n");
return 0;
}
else if(t>T)
{
printf("Not enough tokens. Total = %d.\n",T);
continue;
}
else
{
if((b==0&&n2<n1)||(b==1&&n2>n1))
{
T+=t;
printf("Win %d! Total = %d.\n",t,T);
}
else
{
T-=t;
printf("Lose %d. Total = %d.\n",t,T);
}
}
}
return 0;
}