本题还是对输出格式有着要求,空格是两个需要注意,其他就是对情况的分类,没有太大难度,下面是完整的代码
#include<iostream>
using namespace std;
int main() {
int T, K, n1, b, t, n2;
cin >> T >> K;
for (int i = 0; i < K; i++) {
cin >> n1 >> b >> t >> n2;
if (T == 0) {
cout << "Game Over." << endl;
break;
}
if (T < t) {
cout << "Not enough tokens. Total = " << T <<"." << endl;
continue;
}
if ((n1 < n2&&b == 1) || (n1 > n2&&b == 0)) {
T = t + T;
cout << "Win " << t << "! Total = " << T << "." << endl;
continue;
}
else {
T = T - t;
cout << "Lose " << t << ". Total = " << T << "." << endl;
continue;
}
}
return 0;
}