题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805264312549376
经验总结:
C++代码:
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int T,K,n1,b,t,n2;
cin>>T>>K;
while(K--){
cin>>n1>>b>>t>>n2;
if(T<=0){
cout<<"Game Over.";
return 0;
}else if(t>T){
cout<<"Not enough tokens. Total = "<<T<<"."<<endl;
}else {
switch(b){
case 0:if(n2<n1){
T += t;
cout<<"Win "<<t<<"! Total = "<<T<<"."<<endl;
}else{
T -= t;
cout<<"Lose "<<t<<". Total = "<<T<<"."<<endl;
}
break;
case 1:if(n2>n1){
T += t;
cout<<"Win "<<t<<"! Total = "<<T<<"."<<endl;
}else{
T -= t;
cout<<"Lose "<<t<<". Total = "<<T<<"."<<endl;
}
break;
}
}
}
return 0;
}