ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1131. Copying

WA 2 py 3.6
Posted by DonCezario 16 Apr 2019 01:33
n, k =map(int, input().split(' '))
z=0
time=0
num = 1
progress = 2
if k==1 and n==1:
    print(n)
elif k ==1:
    print(n-1)
elif k>=n:
    time+=1
    while num<n:
        num+=progress
        progress*=2
        time+=1
    print(time)
else:
    time+=1
    while z==0:
        if progress<=k and num<n:
            num+=progress
            progress*=2
            time+=1
        else:
            z+=1
    progress=k
    if num<n:
        while num<n:
            if num<n:
                time+=1
                num+=progress
    print(time)

Edited by author 16.04.2019 01:34