QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#623019#5721. Dividing by TwoyaffenatorTL 495ms10744kbPython3519b2024-10-09 09:37:282024-10-09 09:37:30

Judging History

This is the latest submission verdict.

  • [2024-10-09 09:37:30]
  • Judged
  • Verdict: TL
  • Time: 495ms
  • Memory: 10744kb
  • [2024-10-09 09:37:28]
  • Submitted

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

output:


result: