【PAT乙级】1071 小赌怡情

题目链接:1071 小赌怡情

#include <iostream>
#include <algorithm>
using namespace std;

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

猜你喜欢

转载自blog.csdn.net/wulingyu501/article/details/109000405
今日推荐