QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#623019 | #5721. Dividing by Two | yaffenator | TL | 495ms | 10744kb | Python3 | 519b | 2024-10-09 09:37:28 | 2024-10-09 09:37:30 |
Judging History
answer
import sys
input = sys.stdin.readline
# For taking space seperated integer variable inputs.
def insep():
return(map(int,input().split()))
def main():
a, b = insep()
operations = 0
while (a != b):
if a < b:
a += 1
operations += 1
else:
if a % 2 == 0:
a = a / 2
operations += 1
else:
a += 1
operations += 1
print(operations)
main()
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 7ms
memory: 10744kb
input:
103 27
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 15ms
memory: 10708kb
input:
3 8
output:
5
result:
ok single line: '5'
Test #3:
score: 0
Accepted
time: 15ms
memory: 10544kb
input:
1010 1010
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 495ms
memory: 10728kb
input:
536780502 141579856
output:
7384733
result:
ok single line: '7384733'
Test #5:
score: -100
Time Limit Exceeded
input:
108493886 96306036