Problem: In 2028 and after a continuous growth, AtCoder Inc. finally built an empire with six cities (City 1, 2, 3, 4, 5, 6)!  There are five means of transport in this empire:    * Train: travels from City 1 to 2 in one minute. A train can occupy at most A people.   * Bus: travels from City 2 to 3 in one minute. A bus can occupy at most B people.   * Taxi: travels from City 3 to 4 in one minute. A taxi can occupy at most C people.   * Airplane: travels from City 4 to 5 in one minute. An airplane can occupy at most D people.   * Ship: travels from City 5 to 6 in one minute. A ship can occupy at most E people.  For each of them, one vehicle leaves the city at each integer time (time 0, 1, 2, ...).  There is a group of N people at City 1, and they all want to go to City 6.   At least how long does it take for all of them to reach there? You can ignore the time needed to transfer.

Submission attempts (in order):
n = int(input())
a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())
lst = [n] + [0] * 5
print ('0', lst)
i = 0
tmp0 = 0

lst[0] != 0
tmp0 = min(lst[0], a)
lst[0] -= tmp0
lst[1] += tmp0
print ('1', lst)

lst[1] != 0
tmp0 = min(lst[1], b)
lst[1] -= tmp0
lst[2] += tmp0
lst[0] != 0
tmp0 = min(lst[0], a)
lst[0] -= tmp0
lst[1] += tmp0
print ('2', lst)

lst[2] != 0
tmp0 = min(lst[2], c)
lst[2] -= tmp0
lst[3] += tmp0
lst[1] != 0
tmp0 = min(lst[1], b)
lst[1] -= tmp0
lst[2] += tmp0
lst[0] != 0
tmp0 = min(lst[0], a)
lst[0] -= tmp0
lst[1] += tmp0
print ('3', lst)

lst[3] != 0
tmp0 = min(lst[3], d)
lst[3] -= tmp0
lst[4] += tmp0
lst[2] != 0
tmp0 = min(lst[2], c)
lst[2] -= tmp0
lst[3] += tmp0
lst[1] != 0
tmp0 = min(lst[1], b)
lst[1] -= tmp0
lst[2] += tmp0
lst[0] != 0
tmp0 = min(lst[0], a)
lst[0] -= tmp0
lst[1] += tmp0
print ('4', lst)

lst[4] != 0
tmp0 = min(lst[4], e)
lst[4] -= tmp0
lst[5] += tmp0
lst[3] != 0
tmp0 = min(lst[3], d)
lst[3] -= tmp0
lst[4] += tmp0
lst[2] != 0
tmp0 = min(lst[2], c)
lst[2] -= tmp0
lst[3] += tmp0
lst[1] != 0
tmp0 = min(lst[1], b)
lst[1] -= tmp0
lst[2] += tmp0
lst[0] != 0
tmp0 = min(lst[0], a)
lst[0] -= tmp0
lst[1] += tmp0
print ('5', lst)

while i < (n + 4):
    if lst == [0, 0, 0, 0, 0, n]:
        print (i + 5)
        break
    else:
        i +=1
    if lst[4] != 0:
        tmp0 = min(lst[4], e)
        lst[4] -= tmp0
        lst[5] += tmp0
    if lst[3] != 0:
        tmp0 = min(lst[3], d)
        lst[3] -= tmp0
        lst[4] += tmp0
    if lst[2] != 0:
        tmp0 = min(lst[2], c)
        lst[2] -= tmp0
        lst[3] += tmp0
    if lst[1] != 0:
        tmp0 = min(lst[1], b)
        lst[1] -= tmp0
        lst[2] += tmp0
    if lst[0] != 0:
        tmp0 = min(lst[0], a)
        lst[0] -= tmp0
        lst[1] += tmp0
    print (lst)

n = int(input())
a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())
ans = 0
memo = 0
if n <= a:
    a = n
    ans += 1
else:
    ans += (n + a -1)//a
    memo = (n + a -1)//a
    print ('A', ans)
if a <= b:
    b = a
    ans += 1
    memo -= 1
    print('B', ans)
else:
    ans = ans - memo + 1 + (n + b -1)//b
    memo = (n + b -1)//b
    print ('B', ans)
if b <= c:
    c = b
    ans += 1
    memo -= 1
else:
    ans = ans - memo +1 + (n + c -1)//c
    memo = (n + c -1)//c
if c <= d:
    d = c
    ans += 1
    memo -= 1
else:
    ans = ans - memo + 1 + (n + d -1)//d
    memo = (n + d -1)//d
if d <= e:
    e = c
    ans += 1
    memo -= 1
else:
    ans = ans - memo + 1 +(n + e -1)//e
print (ans)

n = int(input())
a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())
ans = 0
memo = 0
if n <= a:
    ans += 1
else:
    ans += (n + a -1)//a
    memo = (n + a -1)//a
    print ('A', ans)
if a <= b:
    b = a
    ans += 1
    memo -= 1
    print('B', ans)
else:
    ans = ans - memo + 1 + (n + b -1)//b
    memo = (n + b -1)//b
    print ('B', ans)
if b <= c:
    c = b
    ans += 1
    memo -= 1
else:
    ans = ans - memo +1 + (n + c -1)//c
    memo = (n + c -1)//c
if c <= d:
    d = c
    ans += 1
    memo -= 1
else:
    ans = ans - memo + 1 + (n + d -1)//d
    memo = (n + d -1)//d
if d <= e:
    e = c
    ans += 1
    memo -= 1
else:
    ans = ans - memo + 1 +(n + e -1)//e
print (ans)

n = int(input())
a =  int(input())
b =  int(input())
c =  int(input())
d =  int(input())
e =  int(input())
ans = 0
memo = 0
if n <= a:
    ans += 1
else:
    ans += (n + a -1)//a
    memo = (n + a -1)//a
    print ('A', ans)
if a <= b:
    ans += 1
    memo -= 1
    print('B', ans)
else:
    ans = ans - memo + 1 + (n + b -1)//b
    memo = (n + b -1)//b
    print ('B', ans)
if b <= c:
    ans += 1
    memo -= 1
else:
    ans = ans - memo +1 + (n + c -1)//c
    memo = (n + c -1)//c
if c <= d:
    ans += 1
    memo -= 1
else:
    ans = ans - memo + 1 + (n + d -1)//d
    memo = (n + d -1)//d
if d <= e:
    ans += 1
    memo -= 1
else:
    ans = ans - memo + 1 +(n + e -1)//e
print (ans)

N = int(input())

ABCDE = [int(input()) for _ in range(5)]

tmp = min(ABCDE)

ans = (N + tmp - 1) // tmp + 4

print (ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted