PTA乙级题 1071. 小赌怡情(15)

【题目链接】


水题

#include<stdio.h>
int main()
{
    int s,n,i,n1,b,t,n2;
    scanf("%d %d",&s,&n);
    for (i=0;i<n;i++)
    {
        scanf("%d %d %d %d",&n1,&b,&t,&n2);
        if (t>s)
        {
            printf("Not enough tokens. Total = %d.\n",s);
            continue;
        }
        if ((n1>n2&&b==0)||(n1<n2&&b==1))
        {
            printf("Win %d! Total = %d.\n",t,t+s);
            s+=t;
        }
        else
        {
            printf("Lose %d. Total = %d.\n",t,s-t);
            s-=t;
        }
        if (s==0)
        {
            printf("Game Over.");
            return 0;
        }
    }
    return 0;
}