Problem:


Score: 300 points

Problem Statement

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.  

Constraints

1 \leq N, A, B, C, D, E \leq 10^{15}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A
B
C
D
E

Output

Print the minimum time required for all of the people to reach City 6, in minutes.

Sample Input 1

5
3
2
4
3
5

Sample Output 1

7

One possible way to travel is as follows.
First, there are N = 5 people at City 1, as shown in the following image:

In the first minute, three people travels from City 1 to City 2 by train. Note that a train can only occupy at most three people.

In the second minute, the remaining two people travels from City 1 to City 2 by train, and two of the three people who were already at City 2 travels to City 3 by bus. Note that a bus can only occupy at most two people.

In the third minute, two people travels from City 2 to City 3 by train, and another two people travels from City 3 to City 4 by taxi.

From then on, if they continue traveling without stopping until they reach City 6, all of them can reach there in seven minutes.

There is no way for them to reach City 6 in 6 minutes or less.

Sample Input 2

10
123
123
123
123
123

Sample Output 2

5

All kinds of vehicles can occupy N = 10 people at a time.
Thus, if they continue traveling without stopping until they reach City 6, all of them can reach there in five minutes.  

Sample Input 3

10000000007
2
3
5
7
11

Sample Output 3

5000000008

Note that the input or output may not fit into a 32-bit integer type.



Sample input:
5
3
2
4
3
5


Sample output:
7

Submission status: Time Limit Exceeded

Solution code:
def trans(x1, A):
    if x1 >= A:
        return A
    else:
        return x1
      
N = int(input())
t = []

for i in range(5):
  t.append(int(input()))

 
x1 = N
x2, x3, x4, x5, x6 = 0, 0, 0, 0, 0

time = 0
while True:
    x2add = trans(x1, t[0])
    x3add = trans(x2, t[1])
    x4add = trans(x3, t[2])
    x5add = trans(x4, t[3])
    x6add = trans(x5, t[4])

    x1 -= x2add
    x2 += x2add
    
    x2 -= x3add
    x3 += x3add
    
    x3 -= x4add
    x4 += x4add
    
    x4 -= x5add
    x5 += x5add
    
    x5 -= x6add
    x6 += x6add
    
    time += 1
    if x6 == N:
        break

print(time)

Submission status: Time Limit Exceeded

Solution code:
N =int(input())
l =[int(input()) for i in range(5)]
l = l[::-1]
s=[0 for i in range(5)]
s.append(N)
ans=0

while True:
    for i in range(5):
        if s[i+1]>=l[i]:
            s[i]+=l[i]
            s[i+1]-=l[i]
        else:
            s[i]+=s[i+1]
            s[i+1]=0
    ans+=1
    if s[0]==N:
        break
print(ans)

Submission status: Time Limit Exceeded

Solution code:
time=0
N=int(input())
p=[N,0,0,0,0,0]
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
while p[5]!=N:
  time=time+1
  for i in range(E):
    if p[4]!=0:
      p[4]=p[4]-1
      p[5]=p[5]+1
  for i in range(D):
    if p[3]!=0:
      p[3]=p[3]-1
      p[4]=p[4]+1
  for i in range(C):
    if p[2]!=0:
      p[2]=p[2]-1
      p[3]=p[3]+1
  for i in range(B):
    if p[1]!=0:
      p[1]=p[1]-1
      p[2]=p[2]+1
  for i in range(A):
    if p[0]!=0:
      p[0]=p[0]-1
      p[1]=p[1]+1
print(time)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

m = []
for i in range(5):
	m.append(int(input()))

s = [n,0,0,0,0,0]
cnt = 0
while s[-1] != n:
	if s[4]-m[4] >= 0:
		s[4] -= m[4]
		s[5] += m[4]
	else:
		s[5] += s[4]
		s[4] = 0
	if s[3]-m[3] >= 0:
		s[3] -= m[3]
		s[4] += m[3]
	else:
		s[4] += s[3]
		s[3] = 0
	if s[2]-m[2] >= 0:
		s[2] -= m[2]
		s[3] += m[2]
	else:
		s[3] += s[2]
		s[2] = 0
	if s[1]-m[1] >= 0:
		s[1] -= m[1]
		s[2] += m[1]
	else:
		s[2] += s[1]
		s[1] = 0
	if s[0]-m[0] >= 0:
		s[0] -= m[0]
		s[1] += m[0]
	else:
		s[1] += s[0]
		s[0] = 0
	cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a,b,c,d,e = [int(input()) for i in range(5)]
li = [n,0,0,0,0,0]
t = 0

while li[5] < n:
    a_1 = min(li[0],a)
    li[0] -= a_1
    b_1 = min(li[1], b)
    li[1] -= b_1
    c_1 = min(li[2], c)
    li[2] -= c_1
    d_1 = min(li[3], d)
    li[3] -= d_1
    e_1 = min(li[4], e)
    li[4] -= e_1

    li[1] += a_1
    li[2] += b_1
    li[3] += c_1
    li[4] += d_1
    li[5] += e_1

    t += 1

print(t)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

list_trans = [A,B,C,D,E]
list = [N,0,0,0,0,0]#initial condition
time = 0

while list[5] < N:
    list_new = [0,0,0,0,0,0]
    for i in range(len(list)-1):
        if (list[i] - list_trans[i]) >= 0:
            list_new[i] -= list_trans[i]
            list_new[i+1] += list_trans[i]
        else:
            list_new[i] -= list[i]
            list_new[i+1] += list[i]
    for i in range(len(list)):
        list[i] = list[i] + list_new[i]
    time += 1
print(time)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
pas = [0]*5
for i in range(5):
  pas[i] = int(input())
city = [0]*6
city[0] = N
temp = [0]*6
times = 0
while city[-1] < N:
  for i in range(len(city)-1):
    if city[i] == 0:
      continue
    temp[i+1] += min(city[i], pas[i])
    city[i] = max(0, city[i]-pas[i])
  for i in range(1,len(city)):
    city[i] += temp[i]
    temp[i] = 0
  times += 1
print(times)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

L = [N,0,0,0,0,0]

time = 0
while L != [0,0,0,0,0,N]:
  if L[4] != 0:
    if L[4] > e:
      L[5] = L[5] + e
      L[4] = L[4] - e
    else:
      L[5] = L[5] + L[4]
      L[4] = 0
  if L[3] != 0:
    if L[3] > d:
      L[4] = L[4] + d
      L[3] = L[3] - d
    else:
      L[4] = L[4] + L[3]
      L[3] = 0
  if L[2] != 0:
    if L[2] > c:
      L[3] = L[3] + c
      L[2] = L[2] - c
    else:
      L[3] = L[3] + L[2]
      L[2] = 0
  if L[1] != 0:
    if L[1] > b:
      L[2] = L[2] + b
      L[1] = L[1] - b
    else:
      L[2] = L[2] + L[1]
      L[1] = 0
  if L[0] != 0:
    if L[0] > a:
      L[1] = L[1] + a
      L[0] = L[0] - a
    else:
      L[1] = L[1] + L[0]
      L[0] = 0
  time = time + 1
  
print(time)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

n = [N, 0, 0, 0, 0, 0]
c = [A, B, C, D, E]
i = 0
while True:
  if n[5] == N:
    print(i)
    break
    
  for j in [4, 3, 2, 1, 0]:
    m = min(n[j], c[j])
    n[j] -= m
    n[j + 1] += m
  i += 1

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

status=np.array([n,0,0,0,0,0])
end=np.array([0,0,0,0,0,n])
t=0

while (status==end).all()==False:
    A=min(a,status[0])
    B=min(b,status[1])
    C=min(c,status[2])
    D=min(d,status[3])
    E=min(e,status[4])
    status=status-np.array([A,B-A,C-B,D-C,E-D,-E])
    t+=1
    # print(status)

print(t)

# m=min(a,b,c,d,e)

# if n<=m:
#     print(5)
# else:
#     print(n//m+1+4)

Submission status: Time Limit Exceeded

Solution code:
time = 0
people = int(input())
capacity = []
for i in range(5):
    capacity.append(int(input()))
city = [0]*6
city[0] = people

while city[5] < people:
    time += 1
    for i in range(5):
        t = min(capacity[4-i],city[4-i])
        city[4-i] -= t
        city[5-i] += t

print(time)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

L = [N,0,0,0,0,0]

time = 0
while L != [0,0,0,0,0,N]:
  if L[4] > e:
    L[5] = L[5] + e
    L[4] = L[4] - e
  else:
    L[5] = L[5] + L[4]
    L[4] = 0
  if L[3] > d:
    L[4] = L[4] + d
    L[3] = L[3] - d
  else:
    L[4] = L[4] + L[3]
    L[3] = 0
  if L[2] > c:
    L[3] = L[3] + c
    L[2] = L[2] - c
  else:
    L[3] = L[3] + L[2]
    L[2] = 0
  if L[1] > b:
    L[2] = L[2] + b
    L[1] = L[1] - b
  else:
    L[2] = L[2] + L[1]
    L[1] = 0
  if L[0] > a:
    L[1] = L[1] + a
    L[0] = L[0] - a
  else:
    L[1] = L[1] + L[0]
    L[0] = 0
  time = time + 1
  
print(time)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
x = [0]
for i in range(5):
    x.append(int(input()))
a = [0, n, 0, 0, 0, 0, 0]
t = 0
while 1:
    f = True
    if a[5] > 0:
        m = min(a[5], x[5])
        a[5] -= m
        a[6] += m
        f = False
    if a[4] > 0:
        m = min(a[4], x[4])
        a[4] -= m
        a[5] += m
        f = False
    if a[3] > 0:
        m = min(a[3], x[3])
        a[3] -= m
        a[4] += m
        f = False
    if a[2] > 0:
        m = min(a[2], x[2])
        a[2] -= m
        a[3] += m
        f = False
    if a[1] > 0:
        m = min(a[1], x[1])
        a[1] -= m
        a[2] += m
        f = False
    if f:
        break
    t += 1
print(t)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=[0]*5
for i in range(5):
    A[i]=int(input())
ans=0
B=[0]*6
B[0]=N
while B[5]<N:
    ans+=1
    for i in range(4,-1,-1):
        if B[i]>=A[i]:
            B[i+1]+=A[i]
            B[i]-=A[i]
        elif B[i]!=0:
            B[i+1]+=B[i]
            B[i]=0
print(ans)

Submission status: Time Limit Exceeded

Solution code:
people=[0 for i in range(6)]
move=[0 for i in range(5)]
n=int(input())
people[0]=n
limit=[0 for i in range(5)]
for i in range(5):
  limit[i]=int(input())
time=0
while people[5]<n:
  for i in range(5):
    move[i]=(min(people[i],limit[i]))
    people[i]-=move[i]
  for i in range(5):
    people[i+1]+=move[i]
  time+=1
print(time)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
inn=[]

times=0

for i in range(5):
    inn.append(int(input()))

hoge=[0 for i in range(6)]
hoge[0]=n

while(hoge[5]!=n):
    times+=1
    for i in range(5):
        ind=4-i
        if(hoge[ind]>0):
            a=hoge[ind]
            hoge[ind] = max(0, hoge[ind]-inn[ind])
            if hoge[ind]>0:
                hoge[ind+1] += inn[ind]
            else:
                hoge[ind+1] += a


print(times)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
lst=[int(input()) for i in range(5)]
l=[0]*5
l.insert(0,n)
ans=0
while l[5]!=n:
    for i in range(5,0,-1):
        if l[i-1]!=0:
            res=min(l[i-1],lst[i-1])
            l[i]+=res
            l[i-1]-=res
        
    ans+=1
   
print(ans)

Submission status: Time Limit Exceeded

Solution code:
def main():
	n = int(input())
	r = [0]*5
	r[0] = int(input())
	r[1] = int(input())
	r[2] = int(input())
	r[3] = int(input())
	r[4] = int(input())
	dp = [n, 0, 0, 0, 0, 0]
	time = 0
	while True:
		time += 1
		for i in range(5, 0, -1):
			if dp[i-1] != 0:
				move = min(r[i-1], dp[i-1])
				dp[i] += move
				dp[i-1] -= move
		if dp[5] == n:
			break
	print(time)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-

a = [0]*5
n = int(input())
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())

b = [0] * 6
b[0] = n

cnt = 0
def move():
    global b,cnt
    c = b[:]
    if b[0] < a[0]:
        c[0] -= b[0]
        c[1] += b[0]
    else:
        c[0] -= a[0]
        c[1] += a[0]
    if b[1] < a[1]:
        c[1] -= b[1]
        c[2] += b[1]
    else:
        c[1] -= a[1]
        c[2] += a[1]
    if b[2] < a[2]:
        c[2] -= b[2]
        c[3] += b[2]
    else:
        c[2] -= a[2]
        c[3] += a[2]
    if b[3] < a[3]:
        c[3] -= b[3]
        c[4] += b[3]
    else:
        c[3] -= a[3]
        c[4] += a[3]
    if b[4] < a[4]:
        c[4] -= b[4]
        c[5] += b[4]
    else:
        c[4] -= a[4]
        c[5] += a[4]
    b = c[:]
    cnt += 1
    if b[5] == n:
        return True
    else:
        return False

reached = False
while(not reached):
    reached = move()

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[int(input()) for _ in range(5)]
num=[n,0,0,0,0,0]
cnt=0
while num[5]<n:
    for i in range(4,-1,-1):
        move=min(num[i],a[i])
        num[i+1]+=move
        num[i]-=move
    cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N, trans = int(input()), [int(input()), int(input()), int(input()), int(input()), int(input())]

persons = [N, 0, 0, 0, 0, 0]

t = 0
while persons[5] != N:
    for i in reversed(list(range(0, 5))):
        if persons[i] > 0:
            np = trans[i] if persons[i] >= trans[i] else persons[i]            
            persons[i] -= np
            persons[i+1] += np
    t += 1    

print(t)

Submission status: Accepted

Solution code:
n = int(input())
abc = [int(input()) for _ in range(5)]
bot = min(abc)
print((n + bot - 1) // bot + 4)

Submission status: Accepted

Solution code:
import math

n = int(input())
abc = [int(input()) for i in range(5)]

ans = 4 + math.ceil(n/min(abc))
print(ans)

Submission status: Accepted

Solution code:
import math


def main():
    n = int(input())
    # n, m = map(int, input().split())
    # a = list(map(int, input().split()))
    # s = input()
    # h = [int(input()) for _ in rane(n)]

    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())
    print(math.ceil(n / min(a, b, c, d, e)) + 4)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
p = [0] * 5
bn = float('inf')
for i in range(5):
  p[i] = int(input())
  if bn > p[i]:
    bn = p[i]
ans = 0
print(math.ceil(N / bn) + (5 - 1))

Submission status: Accepted

Solution code:
n=int(input())
t=[int(input()) for i in range(5)]
k=0
for i in range(5):
    k=max(k,(n+t[i]-1)//t[i])
print(k+4)

Submission status: Accepted

Solution code:
N = int(input())
T = []
for i in range(5):
    T.append(int(input()))
k = 0
for i in range(5):
    if N % T[i] == 0:
        k = max(k, N//T[i])
    else:
        k = max(k, N//T[i] + 1)
print(4 + k)

Submission status: Accepted

Solution code:
from math import *

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

ans = ceil(n / a[0])
min = 0
for i in range(1, 5):
  if a[i] >= a[min]:
    ans += 1
  else:
    ans = ceil(n / a[i]) + i
    min = i

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = [int(input()) for _ in range(5)]

if min(l) >= n:
    print(5)
else:
    print((n-1)//min(l) + 5)

Submission status: Accepted

Solution code:
n = int(input())
abcde = [int(input()) for _ in range(5)]

print(4-(-n//min(abcde)))

Submission status: Accepted

Solution code:
n = int(input())
gates = [int(input()) for _ in range(5)]
bn = min(gates)

print(int((n + bn - 1) / bn) + 4)

Submission status: Accepted

Solution code:
import math
n = int(input())
a = [int(input()) for i in range(5)]

print(math.ceil(n/min(a))+4)

Submission status: Accepted

Solution code:
import math


def main():
    n = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    l = [n, 0, 0, 0, 0, 0]
    time = 0

    move_a = a
    move_b = min(move_a, b)
    move_c = min(move_b, c)
    move_d = min(move_c, d)
    move_e = min(move_d, e)

    time = math.ceil(n / move_e) + 4

    print(time)


'''
    while True:
        move_a = min(a, l[0])
        move_b = min(b, l[1])
        move_c = min(c, l[2])
        move_d = min(c, l[3])
        move_e = min(c, l[4])

        l[0] -= move_a
        l[1] += move_a
        l[1] -= move_b
        l[2] += move_b
        l[2] -= move_c
        l[3] += move_c
        l[3] -= move_d
        l[4] += move_d
        l[4] -= move_e
        l[5] += move_e

        time += 1
        if l[5] >= n:
            break

    print(time)
'''

'''
    0: [n-a, a, 0, 0, 0, 0]
    1: [n-2a,2a-b, b, 0, 0, 0]
    2: [n-3a,3a-2b, 2b-c, c, 0, 0]
    3: [n-4a, 4a-3b, 3b-2c, 2c-d, d, 0]
    4: [n-5a, 5a-4b, 4b-3c, 3c-2d, 2d-e, e]
    5: [n-6a, 6a-5b, 5b-4c, 4c-3d, 3d-2e, 2e]
    6: [n-7a, 7a-5b, 6b-5c, 5c-4d, 4d-3e, 3e]

    v1: 全員が0->1に移動する: math.ceil(n/a)
    v2: 全員が1->2に移動する: math.ceil(n/min(v1, b))
    v3: 2->3: math.ceil

'''


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())
    min_v = min([A, B, C, D, E])
    if N % min_v != 0:
        print(4 + N // min_v + 1)
    else:
        print(4 + N // min_v)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import  math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
print(math.ceil(N/min(A,B,C,D,E)) + 4)

Submission status: Accepted

Solution code:
n=int(input())
x = [int(input()) for _ in range(5)]
p = min(x)
q = n//p
if n % p == 0:
        print(q+4)
else:
        print(q+5)

Submission status: Accepted

Solution code:
N=int(input())
A=[int(input()) for _ in range(5)]
print((N-1)//min(A)+1+4)

Submission status: Accepted

Solution code:
import math
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
bottle = min([A, B, C, D, E])
if bottle < N:
  print(math.ceil(N/bottle)+4)
else:
  print(5)

Submission status: Accepted

Solution code:
n = int(input())

passenger = []
for i in range(5):
    passenger.append(int(input()))
    
minimum = min(passenger)

ans = -(-n//minimum)

print(ans+4)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 12 23:38:36 2020

@author: liang
"""

N = int(input())
cost = [int(input()) for _ in range(5)]
cost.sort()
if N%cost[0] == 0:
    ans = 4 + N//cost[0] 
else:
    ans = 4 + N//cost[0] + 1
print(ans)

Submission status: Accepted

Solution code:
from math import ceil
n,a,b,c,d,e=[int(input()) for i in range(6)]
print(ceil(n/min(a,b,c,d,e))+4)

Submission status: Accepted

Solution code:
import math
a = int(input())
b = []
for i in range(5):
  b.append(int(input()))
c = min(b)
d = math.ceil(a/c)
print(d+4)

Submission status: Accepted

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

transportations = [A, B, C, D, E]
minCap = min(transportations)
minIdx = transportations.index(minCap)
transportations.pop(minIdx)

time = N // minCap
if N % minCap != 0:
	time += 1
	
time += 4

print(time)

Submission status: Accepted

Solution code:
f=lambda:int(input())
N=f()
D=[0]*5
for i in range(5):
    D[i]=f()

m=min(D)
g=-(-(N-m)//m)

print(5+g)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(input()) for i in range(5)]
if n%min(a)==0:
  print(4+n//min(a))
else:
  print(5+n//min(a))

Submission status: Accepted

Solution code:
#70 C - Five Transportations
N = int(input())
lis = [int(input()) for _ in range(5)]
mini = min(lis)
group = (N+mini-1)//mini

ans = 5 + group - 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
tp = []
tmp = 10**15
for _ in range(5):
    a = int(input())
    if tmp > a:
        tmp = a
    tp.append(a)

if tmp >= n:
    print(5)
    exit()

cnt = n//tmp
mod = n%tmp

if mod > 0:
    print(5+cnt)
else:
    print(5+cnt-1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b

def main():
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    x = min(A, B, C, D, E)

    ans = 5
    ans += N // x
    if N % x == 0:
        ans -= 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
ar=[]
for _ in range(5):
    ar.append(int(input()))
m=min(ar)
from math import ceil
k=ceil(n/m)
print(k+4)

Submission status: Accepted

Solution code:
from math import ceil


n,a,b,c,d,e = [int(input()) for i in range(6)]
print(ceil(n/min(a,b,c,d,e))+4)

Submission status: Accepted

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print(n//min(a,b,c,d,e)+4) if n%min(a,b,c,d,e)==0 else print((n//min(a,b,c,d,e)+1)+4)

Submission status: Accepted

Solution code:
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from math import *

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1

N = [int(input()) for _ in range(6)]
print((N[0]-1)//min(N[1:])+5)

Submission status: Accepted

Solution code:
import math
N = int(input())
L = [int(input()) for i in range(5)]
print(math.ceil(N/min(L))+4)

Submission status: Accepted

Solution code:
from math import *

N=int(input())
abcde=[int(input()) for _ in range(5)]
print(ceil(N/min(abcde))+4)

Submission status: Accepted

Solution code:
import math
N = int(input())
lsT = []
for i in range(5):
    lsT.append(int(input()))
print(4+math.ceil(N/min(lsT)))

Submission status: Accepted

Solution code:
n=int(input())
from math import ceil
a,b,c,d,e=[int(input()) for i in range(5)]
print(max( ceil(n/a),ceil(n/b),ceil(n/c),ceil(n/d),ceil(n/e), )+4)

Submission status: Accepted

Solution code:
import math

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

latest = min(V)
ans = math.ceil(N/latest) + 4
print(ans)

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, A, B, C, D, E):
    tmp = min(A, B, C, D, E)
    tmp, tmp2 = divmod(N, tmp)
    tmp += 0 if tmp2 == 0 else 1
    print(tmp + 4)


if __name__ == '__main__':
    N = int(input())
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())
    solve(N, A, B, C, D, E)

    # # test
    # from random import randint
    # from func import random_str
    # solve()

Submission status: Accepted

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
from math import ceil
a = ceil(N/A)
F = [A,B,C,D,E]
for i in range(1,5):
    if F[i-1] <= F[i]:
        a += 1
    else:
        b = ceil(N/F[i])
        a = max(a+1,b+i)
print(a)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    data = [int(input()) for i in range(5)]
    quo, rem = divmod(n, min(data))
    print(4 + quo + bool(rem))


main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    data = [int(input()) for i in range(5)]
    quo, rem = divmod(n, min(data))
    quo = 5 + quo
    if rem:
        print(quo)
    else:
        print(quo - 1)

main()

Submission status: Accepted

Solution code:
N = int(input())
T = []
for _ in range(5):
  T.append(int(input()))

print((N + min(T) - 1) // min(T) + 4)

Submission status: Accepted

Solution code:
'''
Created on 2020/08/30

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  A=int(pin())
  B=int(pin())
  C=int(pin())
  D=int(pin())
  E=int(pin())
  
  t=min(A,B,C,D,E)
  if N%t==0:
    print(N//t+4)
  else:
    print(N//t+5)
  return 
main()

Submission status: Accepted

Solution code:
n = int(input())
a = [int(input()) for _ in range(5)]
minimum = min(a)
print((n + minimum - 1) // minimum + 4)

Submission status: Accepted

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())


print(5+(n-1)//min([a,b,c,d,e]))

Submission status: Accepted

Solution code:
N = int(input())
A = []
for i in range(5):
  A.append(int(input()))
m = min(A)
print(4 + (N + m - 1) // m)

Submission status: Accepted

Solution code:
N = int(input())
T = [0] * 5
for i in range(5):
    T[i] = int(input())

from math import ceil
t = min(T)
print(ceil(N/t) + 4)

Submission status: Accepted

Solution code:
from math import ceil
n = int(input())
a = [int(input()) for i in range(5)]
print(ceil(n/min(a))-1+5)

Submission status: Accepted

Solution code:
import math
n=int(input())
x=[]
for i in range(5):
  x.append(int(input()))
if n==min(x):
  print(5)
else:
  print(4+math.ceil(n/min(x)))

Submission status: Accepted

Solution code:
import math

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

print(4 + math.ceil(n / min(capa)))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc123/tasks/abc123_c
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    a = input_int()
    b = input_int()
    c = input_int()
    d = input_int()
    e = input_int()
    _min = min(a, b, c, d, e)
    ans = (n // _min) - 1 + 5
    if n % _min > 0:
        ans += 1
    print(ans)

    return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math
N = int(input())
mobile = [int(input()) for _ in range(5)]

res = math.ceil(N/min(mobile)) + 4

print(res)

Submission status: Accepted

Solution code:
N=int(input())
li=[0,0,0,0,0]
for i in range(5):
    li[i]=int(input())

if N%min(li)==0:
    a=N//min(li)-1
else:
    a=N//min(li)
ans=5+a

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
A = []
for i in range(5):
  A.append(int(input()))

minA = min(A)

import math
print(4+math.ceil(n/minA))

Submission status: Accepted

Solution code:
n = int(input())
x = min([int(input()) for _ in range(5)])

a, b = divmod(n, x)
if b == 0:
    print(5+(a-1))
else:
    print(5+a)

Submission status: Accepted

Solution code:
n, a, b, c, d, e = [int(input()) for _ in range(6)]
minVal = min(a, b, c, d, e)
if n // minVal == n / minVal:
    ans = n // minVal + 4
else:
    ans = (n // minVal + 1) + 4
print(ans)

Submission status: Accepted

Solution code:
n,*a = [int(input()) for _ in range(6)]
print(((n+min(a)-1)//min(a)+4))

Submission status: Accepted

Solution code:
a = [int(input()) for i in range(6)]
mi=min(a)
if(a[0]==mi):print(5)
else: 
    if(a[0]%mi==0): print(5+a[0]//mi-1)
    else: print(5+a[0]//mi)

Submission status: Accepted

Solution code:
import math


def main():
    n = int(input())
    csr = []
    for _ in range(5):
        csr.append(int(input()))
    # print(5+n//min(csr))
    print(4+math.ceil(n/min(csr)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
m = min(a,b,c,d,e)
if n%m!=0:
  t = n//m +5
else:
  t = n//m +4
print(t)

Submission status: Accepted

Solution code:
n = int(input())
x = [int(input()) for i in range(5)]
d = n // min(x)
if n%min(x)==0:
  print(d+4)
else:
  print(d+5)

Submission status: Accepted

Solution code:
from math import ceil
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(ceil(n / min(a,b,c,d,e)) + 4)

Submission status: Accepted

Solution code:
import math
N = int(input())
A = [int(input()) for _ in range(5)]
print(math.ceil(N/min(A))+4)

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    semai = float("inf")
    for _ in range(5):
        minute = I()
        semai = min(semai,minute)
    
    group = (n+semai-1)//semai
    ans = group + 4
    print(ans)
main()

Submission status: Accepted

Solution code:
n = int(input())
data = [int(input()) for i in range(5)]
m = min(data)
if n%m==0:
  print(4+n//m)
else:
  print(5+n//m)

Submission status: Accepted

Solution code:
n = int(input())

x = float('inf')
for _ in range(5):
    a = int(input())
    x = min(x,a)

print((n-1)//x + 5)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

sys.setrecursionlimit(1000000)
dire, dire8 = [[1, 0], [0, 1], [-1, 0], [0, -1]], [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets, ALPHABETS = "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD, INF = 1000000007, float("inf")

def main():
    N = I()
    ABCDE = IR(5)
    print(5 + N // min(ABCDE) - int(min(ABCDE) == 1))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
import numpy as np
N,*T = map(int,open(0).read().split())

X = np.array(T).min()

print(4+math.ceil(N/float(X)))