1071 小赌怡情 (15 分)

#include <iostream>
#include <string>
using namespace std;
int main(){
    int T, K;
    cin >> T >> K;
    while (K--){
        int n1, b, t, n2;
        cin >> n1 >> b >> t >> n2;
        if (t > T) { //结果的输出前后顺序需要注意,好有就是格式很重要。
            cout << "Not " << "enough tokens.  Total = " << T << '.' << endl;
            continue;
        }
        if ((n1 > n2 && b == 0) || (n1 < n2 && b == 1)) {
            T += t;
            cout << "Win " << t << "!  Total = " << T << '.' << endl;
        }
        else {
            T -= t;
            cout << "Lose " << t << ".  Total = " << T << '.' << endl;
            if (T == 0){
                cout << "Game over.";
                break;
            }
        }
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/Hk456/p/10742339.html