QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215040#7533. Jeopardized Betting0xC0FFEE#TL 0ms0kbC++20507b2023-10-15 02:34:522023-10-15 02:34:53

Judging History

你现在查看的是最新测评结果

  • [2023-10-15 02:34:53]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-10-15 02:34:52]
  • 提交

answer

#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;

	int l, w;
	long long int money, bet, x;
	money = 1LL << (2*n);
	x = money;
	bet = money / 2;
	l = 0;
	w = 0;
	

	while (l != n && w!=n) {
		if (w == n-1) {
			cout << 2 * x - money << '\n';
		}
		else {
			cout << bet << '\n';
			string res;
			cin >> res;

			if (res == "Won") {
				money += bet / 2;
				bet /= 2;
			}
			else {
				money -= bet;
				bet *= 2;
			}
		}
	}
	cout << money;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

3
Lost

output:

32
64

result: