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: Wrong Answer

Solution code:
def calculation(passenger: int, transport_number: list):
    timecount = 1
    location = [passenger,0,0,0,0,0]
    transport = transport_number
    while True:
        timecount += 2
        print(location)
        print(transport)
        # for x,j in enumerate(self.transport):
        for x in range(len(transport_number)):
            if location[x] < transport[x]:
                location[x+1] += location[x]
                location[x] = 0
            elif location[x] >= transport[x]:
                location[x] -= transport[x]
                location[x+1] += transport[x]

        if location[5] == passenger:
            break

        # print(sum(location))
        # if sum(location) == 0:
        #     break

    return timecount

if __name__ == "__main__":
    # passenger = 5
    # transport_number = [3 ,2 ,4 ,3 ,5]
    passenger = int(input())
    transport_number = [int(input()) for i in range(5)]
    # passsenger_transporter = PassengerLocation(passenger=passenger, transport_number=transport_number)
    # print(passsenger_transporter.calculation())
    calculation(passenger=passenger, transport_number=transport_number)

Submission status: Wrong Answer

Solution code:
def calculation(passenger: int, transport_number: list):
    timecount = 1
    location = [passenger,0,0,0,0,0]
    transport = transport_number
    while True:
        timecount += 2
        print(location)
        print(transport)
        # for x,j in enumerate(self.transport):
        for x in range(len(transport_number)):
            if location[x] < transport[x]:
                location[x+1] += location[x]
                location[x] = 0
            elif location[x] >= transport[x]:
                location[x] -= transport[x]
                location[x+1] += transport[x]

        if location[5] == passenger:
            break

        # print(sum(location))
        # if sum(location) == 0:
        #     break

    return timecount

if __name__ == "__main__":
    passenger = 5
    transport_number = [3 ,2 ,4 ,3 ,5]
    # passenger = int(input())
    # transport_number = [int(input()) for i in range(5)]
    # passsenger_transporter = PassengerLocation(passenger=passenger, transport_number=transport_number)
    # print(passsenger_transporter.calculation())
    calculation(passenger=passenger, transport_number=transport_number)

Submission status: Wrong Answer

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

n_min = min(a,b,c,d,e)

if n_min >= n:
    print(5)

else:
    if n%n_min ==0:
        print(5 -1 + n//2)
    else:
        print(5 + n//2)

Submission status: Wrong Answer

Solution code:
print(5+int(input())//min([int(input()) for _ in range(5)]))

Submission status: Wrong Answer

Solution code:
N = int(input())
Q = [int(input()) for i in range(5)]
 
min_value = min(Q)
min_index = Q.index(min_value)
if N%min_value == 0:
  print(N//min_value + N - 1)
else:
  print(N//min_value + N)

Submission status: Wrong Answer

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

min_value = min(Q)
min_index = Q.index(min_value)
if N%min_value == 0:
  print(min_index + N//min_value + N - min_index - 1)
else:
  print(min_index + N//min_value + 1 + N - min_index - 1)

Submission status: Wrong Answer

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

min_value = min(Q)
min_index = Q.index(min_value)

print(5 + N//min_value)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
a = []
for i in range(5):
    a.append(int(input()))
# a -> b -> c -> d -> e
# 各都市において開始時刻から最終時刻まで見ればいい
# まずa->bにするのに何分かかるか
# 最初と最後だけ分かればいい
prev = 0
lastInput = n
for i in range(len(a)):
    notStop = prev + math.ceil(lastInput / a[i])
    stopped = math.ceil(n / a[i]) + i
    prev = max(notStop, stopped)
    # print("{} vs {}".format(notStop, stopped))
    if notStop < stopped:
        lastInput = n % a[i]
        # print("ok")
    else:
        lastInput %= a[i]
    # print("prev:{} lastInput:{}\n".format(prev, lastInput))
print(prev)

Submission status: Wrong Answer

Solution code:
n = int(input())
def ti():
    return int(input())

a = [None] * 5
for _ in range(5):
    a[_] = ti()
t = n // min(a) + 5
print(t)

Submission status: Wrong Answer

Solution code:
n=[int(input()) for i in range(6)]
print(n[0]//min(n[1:])+5)

Submission status: Wrong Answer

Solution code:
n=[int(input()) for i in range(6)]
m=[n[0]]
t=5
for i in range(5):
    if n[i+1] < m[-1]:
        t+=m[-1]//n[i+1]
        m.append(n[i+1])
print(t)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
MAX = 10**15+1
a_min = MAX

for i in range(5):
    a = int(input())
    A.append(a)
    if a_min > a:
        a_min = a

print(N//a_min+5)

Submission status: Wrong Answer

Solution code:
N = int(input())
norimono_list = [int(input()) for i in range(5)]
# print(norimono_list)

print(N // min(norimono_list) + 5)

Submission status: Wrong Answer

Solution code:
answer = 0
pre = int(input())-1
for _ in range(5):
    now = int(input())
    answer += pre // now + 1
    pre = min(pre, now-1)
print(answer)

Submission status: Wrong Answer

Solution code:
answer = 0
pre = int(input())
for _ in range(5):
    now = int(input())
    answer += pre // now + 1
    pre = min(pre, now)
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(5):
  a.append(int(input()))
neck = min(a)
print(int(n / neck) + 5)

Submission status: Wrong Answer

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

#print ("N:",N)
#print ("cities:",cities)

ans = 0

people = [N,0,0,0,0,0]
latest = 0

# maybe O(N)
'''
while True:
	if (people[-1] == N):
		break
	else:
		for i in reversed(range(len(cities))):
			tmp = people[i]
			people[i] = max(0, people[i] - cities[i])
			people[i+1] += tmp - people[i]


	ans += 1
'''
critical = N // min(cities)

print (5 + critical)

Submission status: Wrong Answer

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

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

print(n//m+5)

Submission status: Wrong Answer

Solution code:
n_and_transport_times = []
for _ in range(6):
    n_and_transport_times.append(int(input()))

ans = 5 #最短で進む場合
max_transport_number = n_and_transport_times[0]

for i in range(1, 6):
    if n_and_transport_times[i] < max_transport_number:
        ans += int(max_transport_number / n_and_transport_times[i])
        max_transport_number = n_and_transport_times[i]

print(ans)

Submission status: Wrong Answer

Solution code:
N,A,B,C,D,E = [int(input()) for i in range(6)]
m = min(A,B,C,D,E)
((N-1) // m) + 5

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [int(input()) for i in range(5)]
print(-~n//min(l)+4)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [int(input()) for i in range(5)]
ans = 0
ans += n//l[0]+1
for i in range(1,5):
  if l[i-1] > l[i]:
    ans += (n-(n//l[i-1]+1-i)*l[i])//l[i]+1
  else:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [int(input()) for i in range(5)]
ans = 0
ans += n//l[0]+1
for i in range(1,5):
  if l[i-1] > l[i]:
    ans += (n-n//l[i-1]*l[i])//l[i]+1
  else:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [int(input()) for i in range(5)]
print(n//min(l)+5)

Submission status: Wrong Answer

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

P = [A, B, C, D, E]
p = min(P)
if p>=N:
    print(5)
else:
    u = (N//p)
    ans = 5+u
    print(ans)

Submission status: Wrong Answer

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

P = [A, B, C, D, E]
p = min(P)
if p>=N:
    print(5)
else:
    u = (N//p)
    ans = 5+(u)
    print(ans)

Submission status: Wrong Answer

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

P = [A, B, C, D, E]
p = min(P)
if p>=N:
    print(5)
else:
    u = (N//p)+(N%p)
    ans = 5+(u-1)
    print(ans)

Submission status: Wrong Answer

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

B = [a, b, c, d, e]

print(int(n/min(B)) + 5)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
print(5 + max(n//a,n//b,n//c,n//d,n//e))

Submission status: Wrong Answer

Solution code:
N = int(input())
_in = []
_N = [N, 0, 0, 0, 0, 0]
for _ in range(5):
    _in.append(int(input()))

ans = 0
while _N[5] < N:
    print(_N)
    _N[5] += min(_N[4], _in[4])
    _N[4] = max(_N[4] - _in[4], 0) + min(_N[3], _in[3])
    _N[3] = max(_N[3] - _in[3], 0) + min(_N[2], _in[2])
    _N[2] = max(_N[2] - _in[2], 0) + min(_N[1], _in[1])
    _N[1] = max(_N[1] - _in[1], 0) + min(_N[0], _in[0])
    _N[0] = max(_N[0] - _in[0], 0)
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
time=[]
for i in range(5):
  time.append(int(input()))
time.append(0)
delay=0
pop=n
for i in range(5):
  trans_time=int((pop-1)//time[i])+1
  delay+=trans_time
  pop=max(pop-(trans_time-1)*time[i],pop-(trans_time-1)*time[i+1])
print(delay)

Submission status: Wrong Answer

Solution code:
n=int(input())
time=[]
for i in range(5):
  time.append(int(input()))
population=[n,0,0,0,0,0]
delay=0
while population[5]<n:
  temp=population[:]
  for i in range(5):
    trans=min(population[i],time[i])
    temp[i]-=trans
    temp[i+1]+=trans
  population=temp[:]
  print(population)
  delay+=1
print(delay)

Submission status: Wrong Answer

Solution code:
def div(n, a):
    if n % a == 0:
        return n / a
    else:
        return n // a + 1


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

bottleneck = 1e5
bottleneck_idx = -1
capa_list = [a, b, c, d, e]
for i in range(len(capa_list)):
    if capa_list[i] <= bottleneck:
        bottleneck = capa_list[i]
        bottleneck_idx = i

ans = div(n, bottleneck) + 4
print(int(ans))

Submission status: Wrong Answer

Solution code:
def div(n, a):
    if n % a == 0:
        return n / a
    else:
        return n // a + 1


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

bottleneck = 1e5
bottleneck_idx = -1
capa_list = [a, b, c, d, e]
for i in range(len(capa_list)):
    if capa_list[i] < bottleneck:
        bottleneck = capa_list[i]
        bottleneck_idx = i

ans = div(n, bottleneck) + 4
print(int(ans))

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
l = []
for _ in range(5):
    l.append(int(input()))
l = np.array(l)
l_min = np.min(l)
if N < l_min:
    print(5)
else:
    result = 5 + (N//l_min)
    print(result)

Submission status: Wrong Answer

Solution code:
N = int(input())
city = []
for i in range(5):
    city.append(int(input()))
kazu = N//min(city) + 1
if N//min(city) == 0:
    print(kazu + 3)
else:
    print(kazu + 4)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
print(5+int(n/min(a, b, c, d, e)))

Submission status: Wrong Answer

Solution code:
def div(n, a):
    if n % a == 0:
        return n / a
    else:
        return n // a + 1


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

bottleneck = 1e5
bottleneck_idx = -1
capa_list = [a, b, c, d, e]
for i in range(len(capa_list)):
    if capa_list[i] < bottleneck:
        bottleneck = capa_list[i]
        bottleneck_idx = i

ans = div(n, bottleneck) + 4
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[int(input())for i in range(5)]
print(n//min(A)+5)

Submission status: Wrong Answer

Solution code:
# coding:utf-8


def main():
    N = int(input())
    facilities = []
    for i in range(5):
        facilities.append(int(input()))
    print(round(N/min(facilities))+4)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

total = 0

ride_list = []

ride_list.append(a)
ride_list.append(b)
ride_list.append(c)
ride_list.append(d)
ride_list.append(e)

ride_list.sort()

round_total = -~n // ride_list[0]

total = round_total + 4

print(total)

Submission status: Wrong Answer

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

total = 0

ride_list = []

ride_list.append(a)
ride_list.append(b)
ride_list.append(c)
ride_list.append(d)
ride_list.append(e)

ride_list.sort()

round_total = -~n // ride_list[0]

total = n / ride_list[0]

if round_total > total:
    total = round_total + 4
else:
    total = round_total + 5

print(total)

Submission status: Wrong Answer

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

total = 0

ride_list = []

ride_list.append(a)
ride_list.append(b)
ride_list.append(c)
ride_list.append(d)
ride_list.append(e)

ride_list.sort()

round_total = round(n / ride_list[0])

total = n / ride_list[0]

if round_total > total:
    total = round_total + 4
else:
    total = round_total + 5

print(total)

Submission status: Wrong Answer

Solution code:
# C Five Transportations
import numpy as np
n = int(input())
time = [int(input()) for i in range(5)]
time = np.array(time, dtype="int64").reshape(5,1)
tempo = np.array([n, 0, 0, 0, 0], dtype="int64").reshape(5,1)
zeros = np.zeros([5,1], dtype="int64")
num = 1
arrive = 0
while arrive < n:
	_ = tempo - time
	_ = np.amax(np.hstack([_, zeros]), axis=1).reshape(5,1)
	movement = np.delete((tempo-_ ), 4)
	movement = np.insert(movement, 0, 0).reshape(5,1)
	tempo = _ + movement
	num += 1	# count #iterates
	arrive += tempo[4]
print(num)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=min(a,b,c,d,e)
print(n//k+5)

Submission status: Wrong Answer

Solution code:
N = int(input())
cyapa = []
for i in range (1,6):
    cyapa.append(int(input()))
kasu = min(cyapa)
if kasu >= N:
    ans = 5
else:
    ans = 5 + N//kasu
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
cyapa = []
for i in range (1,6):
    cyapa.append(int(input()))
kasu = min(cyapa)
if kasu >= N:
	ans = 5
else:
    ans = 5 + N//kasu
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())

max_nums = []
for i in range(5):
  max_nums.append(int(input()))
max_nums.append(n)
a = n/min(max_nums)
print(int(a)*5 + (0 if a == int(a) else 1))

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
n = int(input())

max_nums = []
for i in range(5):
  max_nums.append(int(input()))
a = n/min(max_nums)
print(int(a)*5 + (0 if a == int(a) else 1))

Submission status: Wrong Answer

Solution code:
n = int(input())

people = [n,0,0,0,0,0]
max_nums = []
for i in range(5):
  max_nums.append(int(input()))
print(int(n / min(max_nums))+1)

Submission status: Wrong Answer

Solution code:
n = int(input())
def move(max_num,before):
  return min(max_num,before)

people = [n,0,0,0,0,0]
max_nums = []
for i in range(5):
  max_nums.append(int(input()))

time = 0
while True:
#for j in range(10):
  time += 1
  move_p = [0] * 6
  for i in range(5):
    move_p[i] -= min(max_nums[i],people[i])
    move_p[i+1] += min(max_nums[i],people[i])
  people = list(map(sum,zip(people,move_p)))
  print(people)
  if people[-1] == n:
    break

print(time)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
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)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[int(input()) for i in range(5)]
m=min(s)
t=n//m+5
print(t)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
# N=5
# A=3
# B=2
# C=4
# D=3
# E=5
# L = [0]*5
# L[0] = N
# count = 0
# while sum(L) != 0:
#     if L[4] != 0:
#         tmp0 = min(L[4],E)
#         L[4] -= tmp0
#     if L[3] != 0:
#         tmp0 = min(L[3],D)
#         L[3] -= tmp0
#         L[4] += tmp0
#     if L[2] != 0:
#         tmp0 = min(L[2],C)
#         L[2] -= tmp0
#         L[3] += tmp0
#     if L[1] != 0:
#         tmp0 = min(L[1],B)
#         L[1] -= tmp0
#         L[2] += tmp0
#     if L[0] != 0:
#         tmp0 = min(L[0],A)
#         L[0] -= tmp0
#         L[1] += tmp0
#     count += 1
print(N // min(A,B,C,D,E) + 5)

Submission status: Wrong Answer

Solution code:
# N = int(input())
# A = int(input())
# B = int(input())
# C = int(input())
# D = int(input())
# E = int(input())
N=5
A=3
B=2
C=4
D=3
E=5
L = [0]*5
L[0] = N
count = 0
while sum(L) != 0:
    if L[4] != 0:
        tmp0 = min(L[4],E)
        L[4] -= tmp0
    if L[3] != 0:
        tmp0 = min(L[3],D)
        L[3] -= tmp0
        L[4] += tmp0
    if L[2] != 0:
        tmp0 = min(L[2],C)
        L[2] -= tmp0
        L[3] += tmp0
    if L[1] != 0:
        tmp0 = min(L[1],B)
        L[1] -= tmp0
        L[2] += tmp0
    if L[0] != 0:
        tmp0 = min(L[0],A)
        L[0] -= tmp0
        L[1] += tmp0
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(5)]
small = min(A)
a = A.index(min(A)) 
bottle = (N+1)/small if small!=1 else N
print(int(4+max(bottle,1)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(5)]
small = min(A)
a = A.index(min(A)) 
bottle = (N+1)/small
print(int(4+max(bottle,1)))

Submission status: Wrong Answer

Solution code:
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
stay_a=N
stay_b=0
stay_c=0
stay_d=0
stay_e=0
stay_f=0
for i in range(100000000000000):
  delta_a=min(stay_a,A)
  stay_a=stay_a-delta_a
  delta_b=min(stay_b,B)
  stay_b=stay_b-delta_b
  delta_c=min(stay_c,C)
  stay_c=stay_c-delta_c
  delta_d=min(stay_d,D)
  stay_d=stay_d-delta_d
  delta_e=min(stay_e,E)
  stay_e=stay_e-delta_e
  stay_b+=delta_a
  stay_c+=delta_b
  stay_d+=delta_c
  stay_e+=delta_d
  stay_f+=delta_e
  print(stay_a,stay_b,stay_c,stay_d,stay_e)
  if stay_f==N:
    break
print(1+i)

Submission status: Wrong Answer

Solution code:
import math
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

if n == 0:
    print(0)
elif n <= min(weights):
    print(5)
elif n % min(weights) > 0:
    print(5 + int(math.ceil(n / min(weights))) - 1)

Submission status: Wrong Answer

Solution code:
import math
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

if n == 0:
    print(0)
elif n < min(weights):
    print(5)
elif n % min(weights) > 0:
    print(5 + int(math.ceil(n / min(weights))) - 1)

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

if n == 0:
    print(0)
elif n < min(weights):
    print(5)
elif n % min(weights) == 0:
    print(int(n / min(weights)) + 5)
else:
    print(int(n / min(weights) + 1) + 5)

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

if n == 0:
    print(0)
elif n < min(weights):
    print(5)
elif n % min(weights) == 0:
    print(int(n / min(weights)))
else:
    print(int(n / min(weights) + 5))

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

if n == 0:
    print(0)
elif n % min(weights) == 0:
    print(int(n / min(weights)))
else:
    print(int(n / min(weights) + 5))

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

if n % min(weights) == 0:
    x = n / min(weights)
else:
    x = n / min(weights) + 5

print(int(x))

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

if n % min(weights) == 0:
    x = n / min(weights) + 1
else:
    x = n / min(weights)
print(int(x) + 5)

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

print(int(n / min(weights)) + 5)

Submission status: Wrong Answer

Solution code:
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

weights = []
for i in range(5):
    w, = read_line(int)
    weights.append(w)

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

# print(weights)

j = 0
while True:
    for i in range(len(weights) + 1):
        m = min(p[-i-1], weights[-i])
        p[-i-1] -= m
        p[min(-1, -i)] += m
    # print(p)
    if sum(p[0:5]) == 0:
        break
    j += 1
print(j)

Submission status: Wrong Answer

Solution code:
src = [int(input()) for _ in range(6)]
t = min(src[1:])
if src[0]%t:
  print(4 + src[0]//t)
else:
  print(4 + src[0]//t + 1)

Submission status: Wrong Answer

Solution code:
src = [int(input()) for _ in range(6)]
print(4 + src[0]//min(src[1:]) + 1)

Submission status: Wrong Answer

Solution code:
import math

s=[int(input()) for x in range(6)]

n=s.pop(0)

t=int(5+math.ceil(n/min(s)))

print(t)

Submission status: Wrong Answer

Solution code:
import math

s=[int(input()) for x in range(6)]

n=s.pop(0)

t=int(5+math.floor(n/min(s)))
    
print(t)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
ls = []
for _ in range(5):
    ls.append(int(input()))
if N <= min(ls):
    print(5)
else:
    mint = min(ls)
    ans = 4+ N//mint 
    print(ans)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
ls = []
for _ in range(5):
    ls.append(int(input()))
if N <= min(ls):
    print(5)
else:
    mint = min(ls)
    ans = 5 + N//mint 
    print(ans)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
ls = []
for _ in range(5):
    ls.append(int(input()))
if N <= min(ls):
    print(5)
else:
    mint = min(ls)
    ans = 5 + N//mint +1
    print(ans)

Submission status: Wrong Answer

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
ls = []
for _ in range(5):
    ls.append(int(input()))
if N <= min(ls):
    print(5)
else:
    mint = min(ls)
    ans = 5 + mint//N +1
    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=[int(input()) for i in range(5)]
print(5+n//min(A))

Submission status: Wrong Answer

Solution code:
n = int(input())
times = [int(input()) for i in range(5)]
bottleneck = times.index(min(times))
after_bn = 4 - bottleneck
before_bn = bottleneck
at_bn = n // min(times) + 1
total_time = before_bn + at_bn + after_bn
print(total_time)

Submission status: Wrong Answer

Solution code:
n=int(input())
v = [int(input()) for i in range(5)]
print((n // min(v))+5)

Submission status: Wrong Answer

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

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

flow = min([a, b, c, d, e])
ans = 5 + n // flow if n > flow else 5

print(ans)