def main():
(X, L, N) = map(int, raw_input().split())
flips = 0
S2 = [0 for _ in range(5)]
S1 = [0 for _ in range(5)]
COUNTER = X
while COUNTER > 0:
#print("S1: ", S1)
#print("S2: ", S2)
#print("COUNTER: ", COUNTER)
#print()
S2.append(S1.pop()) #Push the top element of S1 onto S2
#Pop the top element of S1
S1 = [v ^ 1 for v in S1]
flips = flips + 1
if S2[-1] > L:
#print("conter.dec", flips)
COUNTER = COUNTER - 1
if COUNTER == 0:
print S2[-1]
#print("total flips: ", flips)
else:
S2.append(N)
S2.append(N)
S2.append(S2.pop() + S2.pop())
S2.append(S2.pop() + S2.pop())
S1.append(S2[-1])
S1.append(S2.pop())
S2.pop()
q = int(input())
for i in range(q):
main()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
37 ms |
11488 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
32 ms |
11104 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
33 ms |
11096 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
33 ms |
11084 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
32 ms |
11092 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
32 ms |
11096 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |