URL 已经复制到剪切板

查看 gist

查看一个gist的详细信息

简介

小赌怡情

名称

PAT1071.cpp

创建者

comzyh

创建时间

2018-01-06 11:47

最后修改

2018-01-06 11:47

代码
#include <cstdio> #include <cstring> #include <iostream> using namespace std; int T, K; int main() { scanf("%d%d", &T, &K); for (int round = 0; round < K; round ++) { int n1, b, t, n2; scanf("%d%d%d%d", &n1, &b, &t, &n2); if (t > T) { printf("Not enough tokens. Total = %d.\n", T); continue; } if ((n2 > n1) == b) { T += t; printf("Win %d! Total = %d.\n", t, T); } else { T -= t; printf("Lose %d. Total = %d.\n", t, T); } if (T == 0) { printf("Game Over.\n"); break; } } return 0; }
分享