QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
3 Lost
output:
32 64