其他分享
首页 > 其他分享> > 1071 小赌怡情 (15 分)

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;
}

 

标签:小赌,怡情,cout,int,&&,n1,15,n2,include
来源: https://www.cnblogs.com/Hk456/p/10742339.html