1071 小赌怡情
Posted gzu_zb
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1071 小赌怡情相关的知识,希望对你有一定的参考价值。
题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805264312549376
题解:
1 #include<iostream> 2 using namespace std; 3 4 int main() { 5 int T, K, n1, b, t, n2; 6 cin >> T >> K; 7 while (K--) { 8 cin >> n1 >> b >> t >> n2; 9 if (T == 0) { 10 cout << "Game Over." << endl; 11 break; 12 } 13 if (t > T) cout << "Not enough tokens. Total = " << T << "." << endl; 14 else { 15 if (b == 0 && n2<n1 || b == 1 && n2>n1) { 16 T += t; 17 cout << "Win " << t << "! Total = " << T << "." << endl; 18 } 19 else { 20 T -= t; 21 cout << "Lose " << t << ". Total = " << T << "." << endl; 22 } 23 } 24 } 25 return 0; 26 }
以上是关于1071 小赌怡情的主要内容,如果未能解决你的问题,请参考以下文章