QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#215040 | #7533. Jeopardized Betting | 0xC0FFEE# | TL | 0ms | 0kb | C++20 | 507b | 2023-10-15 02:34:52 | 2023-10-15 02:34:53 |
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;
}
详细
Test #1:
score: 0
Time Limit Exceeded
input:
3 Lost
output:
32 64