1071 小赌怡情 (15 point(s))

#include <bits/stdc++.h>
using namespace std;

int main() {
	int T, K, n1, b, t, n2, x;
	cin >> T >> K;
	// 初始化当前筹码 
	x = T;
	while(K--){
		cin >> n1 >> b >> t >> n2;
		
		if(t > x){
			printf("Not enough tokens.  Total = %d.\n", x);
		}
		else if((n1 < n2 && b == 1) || (n1 > n2 && b == 0)){
			x += t;
			printf("Win %d!  Total = %d.\n", t, x);
		}
		else{
			x -= t;
			printf("Lose %d.  Total = %d.\n", t, x);
		}
		
		// 输光
		if(x <= 0) {
			cout << "Game Over.\n";
			return 0;
		} 
	}
}
上一篇:Leecode no.70 爬楼梯


下一篇:vue.js使用el-cascader