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:
import sys
import math

input = sys.stdin.readline

n = int(input())

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

lis.sort()

p = lis[0]

if (n > p):
    print(5 + int(n / p) + math.ceil(n % p)-1)
else:
    print(5)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from math import modf

n, a, b, c, d, e = [int(input()) for _ in range(6)]
r = [h for h in [a,b,c,d,e] if h != 1]
if r:
  r = min(r)
else:
  r = 2
if 1 in [a,b,c,d,e]:
  r -= 1
dd, ii = modf(n/r)
ll = int(ii)+int(dd*10)
print(max(5,ll))

Submission status: Wrong Answer

Solution code:
k=int(input())
maxval=[int(input())for i in range(5)]
stuck=False
stucknum=4
for i in range(4):
  if stuck==False:
    if maxval[i]<=maxval[i+1]:
      stucknum=i
      stuck=True
  else:
    if maxval[stucknum]>=maxval[i]:
      stucknum=i
else:
  if maxval[stucknum]>=maxval[4]:
    stucknum=4
print(k//maxval[stucknum]+5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A_E = [int(_) for _ in input().split()]
A_E.sort()
time = int(N/A_E[0])
if N % A_E[0]:
    time += 1
time += 4
print(time)

Submission status: Wrong Answer

Solution code:
N=int(input())
List=[int(input()) for i in range(5)]
sList = sorted(List)
#print(sList[0])
if sList[0]>=N:
  print(5)
else:
  print((N//sList[0])+5)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
l = [A,B,C,D,E]
m = min(l)
mn = l.index(m)
c = 0
cities = [N,0,0,0,0,0]
while l[mn] == 0:
    p00 = min(A,cities[0])
    p01 = min(B,cities[1])
    p02 = min(C,cities[2])
    p03 = min(D,cities[3])
    p04 = min(E,cities[4])
    cities[0]-=p00
    cities[1]-=p01
    cities[2]-=p02
    cities[3]-=p03
    cities[4]-=p04
    cities[1]+=p00
    cities[2]+=p01
    cities[3]+=p02
    cities[4]+=p03
    cities[5]+=p04
    c += 1
c += 5-mn+N//m
print(c)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
S = [0,0,0,0,0]
S[0] = int(input())
S[1] = int(input())
S[2] = int(input())
S[3] = int(input())
S[4] = int(input())

ct = 5
MIN = S[0]
Mp = 0
f = 0

if N <= S[0] :
    f = 0
else :
    ct = ct + (N // S[0])
    f = 1

for i in range(4):
    if f == 0 and N <= S[i+1] :
        continue
    elif S[i+1] >= MIN:
        f = 1
        continue
    else:
        if MIN // S[i+1] > Mp:
            Mp = MIN // S[i+1]
            MIN = S[i+1]
        f = 1
ct = ct + Mp

print(ct)

Submission status: Wrong Answer

Solution code:
import math

number = int(input())
numbers = []

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

shortest = numbers[0]
index = 0
for i in range(5):
    if shortest > numbers[i]:
        shortest = numbers[i]
        index = i

time = 0
if number % shortest == 0:
    time = number / shortest
else:
    time = math.ceil(number / shortest) - 1

print(time + (5 - index))

Submission status: Wrong Answer

Solution code:
a = []
for i in range(6):
  a.append(int(input()))
print(5 + (a[0] // min(a))) if min(a) < a[0] else print(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())

t=0
A1=N
A2=0
A3=0
A4=0
A5=0
A6=0

for t in range(N*N):
    t=t+1

    A1=A1-a
    if t>1:
        A2=A2-b
        if t>2:
            A3=A3-c
            if t>3:
                A4=A4-d
                if t>4:                
                    A5=A5-e
    if A6==N:
        break
    if t>=1:
        if A1<a:
            A2=A2+A1
        else:
            A2=A2+a
    if t>=2:
        if A2<b:
            A3=A3+A2
        else:
            A3=A3+b
    if t>=3:
        if A3<c:
            A4=A4+A3
        else:
            A4=A4+c
    if t>=4:
        if A4<d:
            A5=A5+A4
        else:
            A5=A5+d
    if t>=5:
        if A5<e:
            A6=A6+A5
        else:
            A6=A6+e

print(t)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
abcde = [int(input()) for _ in range(5)]

time = 0
next_n = 0 # 次の駅でまだ残っている人数
last = N # 最後の1回で移動する人数
for i in range(5):
  time += (last + next_n) // abcde[i]
  if (last + next_n) % abcde[i] > 0:
    time += 1

  last = (last + next_n) % abcde[i]
  if last == 0:
    last = min(abcde[i], (last+next_n))

  if i < 4: 
    next_n = max((N-last) - (time-1) * abcde[i+1], 0)


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())
T=[E,D,C,B,A]

time=0
initial=0
p=[0]*6
p[5]=N
print(T)
m=min(T)

print(N//m+5)

Submission status: Wrong Answer

Solution code:
N = int(input())
numbers = [int(input()) for _ in range(5)]
flag = True

for number in numbers:
    if number < N:
        flag = False
        
if flag:
    print(5)

else:
    sum_number = 0
    tunnel = 0
    flag = True
    
    for i in range(len(numbers)-1):
        sum_number += numbers[i]

        if numbers[i+1] < numbers[i]:
            tunnel += numbers[i+1] // numbers[i]
        
        if N <= sum_number:
            print(5 + tunnel + (N // numbers[0]))
            flag = False
            break
            
    if flag:
        print(5 + tunnel + N // numbers[0])

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
tr = []
for i in range(0, 5):
    tr.append(int(input()))
t = 0
if tr[0]<tr[1]:
    t += math.ceil(N/tr[0])
else:
    t += 1
min = tr[0]
for i in range(1, 5):
    if tr[i]<min:
        t += math.ceil(N/tr[i])
    else:
        t += 1
print("{}".format(t))

Submission status: Wrong Answer

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
lists = []
for i in range(5):
	lists.append(int(stdin.readline().rstrip()))

min = lists[0]

for l in lists:
  if l < min:
    min = l

if n == min:
  	print(5)
else:
	print(int(n/min + 5))

Submission status: Wrong Answer

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

P1toP2 = math.ceil(N / iList[0])
P2toP3 = math.ceil(min(N, min(iList[:1])) / iList[1])
P3toP4 = math.ceil(min(N, min(iList[:2])) / iList[2])
P4toP5 = math.ceil(min(N, min(iList[:3])) / iList[3])
P5toP6 = math.ceil(min(N, min(iList[:4])) / iList[4])


# print(P1toP2 , P2toP3 , P3toP4 , P4toP5 , P5toP6)
print(P1toP2 + P2toP3 + P3toP4 + P4toP5 + P5toP6)

Submission status: Wrong Answer

Solution code:
N = int(input())
moves = [int(input()) for _ in range(5)]
a = min(moves)
lst = [N % a ,0,0,0,0]
ret = N // a

if N % a == 0:
    print(ret)
else:
    if a == lst[0]:
        print(ret + 5)
    elif a == lst[1]:
        print(ret + 4)
    elif a == lst[2]:
        print(ret + 3)
    elif a == [3]:
        print(ret + 4)
    else:
        print(ret + 5)

Submission status: Wrong Answer

Solution code:
import math

nyan = []
num = 0
for i in range(6):
  nyan.append(int(input()))

min = nyan[1]

for i in range(5):
  if nyan[i+1] < min :
    min = nyan[i+1]

ans = nyan[0]//min +5
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A_E = [int(_) for _ in input().split()]
A_E.sort()
time = N/A_E[0]
if N % A_E[0]:
    time += 1
time += 4
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())
 
time = 0
cnt = 1
for prev, after in [(A, B), (B, C), (C, D), (D, E), (E, 0)]:
  if prev < N:
    t = N // prev + int(N % prev > 0)
    if prev <= after:
      time += t
      if N % prev:
        N = N % prev
      else:
        N = prev
    else:
      time += t
      if N % prev:
        N = (prev - after) * (time - cnt) + N % prev
      else:
        N = (prev - after) * (time - cnt) + prev
  else:
    time += 1
    if prev > after:
      N = (prev - after) * (time - cnt) + N
  cnt += 1
print(time)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
a = [int(input()) for i in range(5)]
count = 0
p = [n, 0, 0, 0, 0, 0]
result = p
while(count <= 3):
    if result[5] == n:
        print(count)
        break
    else:
        for i, per in enumerate(p[:-1]):
            if per >= a[i]:
                result[i] -= a[i]
                result[i + 1] += a[i]
            elif per > 0 and per < a[i]:
                result[i] -= per
                result[i + 1] += per
    p = result
    count += 1
aa = [math.ceil(p[i] / a[i]) for i in range(5)]

print(count + sum(aa))

Submission status: Wrong Answer

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])
ans = N//M + 5
if N == M:
    print(5)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import math

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

print(n)

# array = [a, b, c, d, e]
"""
if n >= a:
    if a >= b:
        if b >= c:
            if c >= d:
                if d >= e:
                    print(5)

上記の組み合わせは５通り。
ここから、n < a の時、ceil(n/a) 切り上げ分だけ、足す。

"""
i = 5
if n <= a:
    if a <= b:
        if b <= c:
            if c <= d:
                if d <= e:
                    pass
                else:
                    i += math.ceil(d/e) -1
            else:
                i += math.ceil(c/d) -1
        else:
            i += math.ceil(b/c) -1 
    else:
        i += math.ceil(a/b) - 1
else:
    i += math.ceil(n/a) - 1
    print(math.ceil(n/a))

print(i)

Submission status: Wrong Answer

Solution code:
li=[0]*6
for i in range(6):
  li[i]=int(input())
cnt=li[1] 
ans=(li[0]-1)//li[1]+1
#print(ans)
for i in range(4):
  if li[i+2]<cnt:
    ans+=(li[0]-1)//li[i+1]+1
    cnt=li[i+1]
  else:
    ans+=1
    cnt=li[i+1]
  #print(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = []
for i in range(5):
  li.append(n//int(input()))
li.sort()
print(li[4]+5)

Submission status: Wrong Answer

Solution code:
data = list(int(input()) for _ in range(6))
# data -> N,A,B,C,D,E,

status = [data[0], 0, 0, 0, 0, 0]
ans    = 0

# step. A
if status[0] > data[1]:
  status[0] = status[0] - data[1]
  status[1] = data[1]
  ans += 1
else:
  status[1] = status[0]
  ans += 1

# step. B
if status[1] > data[2]:
  status[1] = status[1] - data[2]
  status[2] = data[2]
else:
  status[2] = status[1]
  ans += 1

# step. C
if status[2] > data[3]:
  status[2] = status[2] - data[3]
  status[3] = data[3]
else:
  status[3] = status[2]
  ans += 1

# step. D
if status[3] > data[4]:
  status[3] = status[3] - data[4]
  status[4] = data[4]
else:
  status[4] = status[3]
  ans += 1

# step. E
if status[4] > data[5]:
  status[4] = status[4] - data[5]
  status[5] = data[5]
else:
  status[5] = status[4]
  ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B, C, D, E= [float(input()) for _ in range(6)]
cities = [A, B, C, D, E]
P = [N, 0, 0, 0, 0, 0]
t = 0
while True:
  for i, c in enumerate(cities):
    s = P[i] - c
    if s < 0 :
      P[i+1] += P[i]
      P[i] = 0
    else :
      P[i+1] += c
      P[i] = s
    t += 1
  if(P[5] > 0):
    break
print(-(-N//P[5]) + t - 1)

Submission status: Wrong Answer

Solution code:
N = int(input())

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


minT = min(T)

indminT = T.index(minT)

time = (indminT + 1) + (N//minT) + 5 - (indminT + 1)

print(time)

Submission status: Wrong Answer

Solution code:
def idou(m, n, i):
    if n[m] != 0:
        if n[m] <= i[m]:
            n[m + 1] += n[m]
            n[m] -= n[m]
        else:
            n[m] -= i[m]
            n[m + 1] += i[m]
    return n


i = []
n = [0] * 6
y = int(input())
for l in range(5):
    i.append(int(input()))
n[0] = y
cnt = 0
while True:
    if (n[5] != y):
        for m in range(4, -1, -1):
            n = idou(m, n, i)
        print(n)
        cnt += 1
    else:
        print(cnt)
        break

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n = int(input())

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

a.sort()

# print(a)

# t = int(n / a[0])
t = n / a[0]
if t == 1.0:
    t = 0
else:
    t = int(t)
# print("t", t)
ans = t + 5
print(ans)

Submission status: Wrong Answer

Solution code:
k = int(input())
n = 5
t = [int(input()) for i in range(n)]

min_time = 5

time = min_time + (k // min(t))

print(time)

Submission status: Wrong Answer

Solution code:
import math
n,a,b,c,d,e=[int(input()) for _ in range(6)]
num=[a,b,c,d,e]
ans=0
ab=0
for i in range(1,len(num)):
    ab+=num[i]-num[i-1]
ans+=math.ceil(n/a)
ans+=math.ceil(a/b)
ans+=math.ceil((a/b)/c)
ans+=math.ceil(((a/b)/c)/d)
ans+=math.ceil((((a/b)/c)/d)/e)
if ab<0:
    ans=math.ceil(n/min(num))+abs(e-d if e-d<0 else 0)+abs(d-c if d-c<0 else 0)+abs(c-b if c-b<0 else 0)+abs(b-a if b-a<0 else 0)
print(ans)

Submission status: Wrong Answer

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

e = []
for i in range(5):
    e.append(int(N / d[i]))

if N == 1:
    print(len(e))
    exit()

print(len(e) + max(e))

Submission status: Wrong Answer

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

sub = [a,b,c,d,e]
min_sub = min(sub)
time = 5


if N%min_sub != 0:
    print(time+int((N/min_sub)))
else:
    print(time+int(N/min_sub)+1)

Submission status: Wrong Answer

Solution code:
import math

nyan = []
num = 0
for i in range(6):
  nyan.append(int(input()))

min = nyan[1]

for i in range(5):
  if nyan[i+1] < min :
    min = nyan[i+1]
    num = i

ans = nyan[0]//min +5
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
Cap=[]
for _ in range(5):
    Cap.append(int(input()))
print(N//Cap[0]+6)

Submission status: Wrong Answer

Solution code:

N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

move= [A,B,C,D,E]
min_move =min(move) 
min_move_idx = move.index(min_move)
time = 5


if N//A >1:
    time += N//A #.....3

for r in range(0,min_move_idx+1):
    time += 1
    

print(time)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l = [int(input()) for _ in range(6)]
N = l[0]
l = l[1:]

c = [0] * 5
for i in range(len(l)):
    if N > l[i]:
        c[i] = N - l[i]
        N = l[i]

res = 0
for i in range(5):
    if c[i] > 0:
        if i == 0 or i == 1:
            res += int(c[i]/l[i]) + 1
        else:
            if c[i] > i:
                res = int(c[i]/l[i])

print(5+res)

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
count = N // a[0]
for i in range(len(a) - 1):
	if(a[i+1] + a[i] <= N and a[i+1] - a[i] < 0):
		count += 1
print(5 + count)

Submission status: Wrong Answer

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

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

min_cs = min(cs)

t = int(n / min_cs) + 1

print(t + 4)

Submission status: Wrong Answer

Solution code:
li=[0]*6
for i in range(6):
  li[i]=int(input())
cnt=li[1] 
c=0
ans=(li[0]-1)//li[1]+1
#print(ans)
for i in range(4):
  if li[i+2]<cnt:
    ans+=(li[0]-1)//li[i+1]+1
    cnt=li[i+1]
    c=1
  else:
    if c==0:
      ans+=1 
    else:
      c=0
      ans+=1
      cnt=li[i+1]
  #print(ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = [int(input()) for i in range(5)]
maxNum = 0
for i in range(len(l)):
    if n > l[i]:
        num = n // l[i]
        if maxNum < num:
            maxNum = num
print(maxNum)

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(n//a+ a//b+ b//c + c//d + d//e+1)

Submission status: Wrong Answer

Solution code:
N, *capacity = [int(input()) for _ in range(6)]

min_index = capacity.index(min(capacity))

ans = N // capacity[min_index]

if N <= capacity[0]:
    print(ans+4)
    exit()
print(ans+5)

Submission status: Wrong Answer

Solution code:
A=list()
B=list()
for i in range(6):
  A.append(int(input()))
  B.append(0)
B[0]=A[0]
count=0
flag2=False
flag3=0
flag=B[1]!=0 or B[2]!=0 or B[3]!=0 or B[4]!=0
if A[0]>1000000:
  flag2=True
  flag3=int(A[0]/A[1])
  A[0]=A[0]%A[1]
  B[0]=A[0]%A[1]
while flag or A[0]!=B[5]:
  for i in reversed(range(5)):
    if A[i+1]-B[i]<0:
      B[i+1]=A[i+1]
      B[i]=B[i]-A[i+1]
    else:
      B[i+1]+=B[i]
      B[i]=0
  count+=1
if flag2==True:
  count+=flag3
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
numbers = [int(input()) for _ in range(5)]
flag = True

for number in numbers:
    if number < N:
        flag = False
        
if flag:
    print(5)

else:
    sum_number = 0
    tunnel = 0
    flag = True
    
    for i in range(len(numbers)-1):
        sum_number += numbers[i]

        if numbers[i+1] < numbers[i]:
            tunnel += numbers[i] // numbers[i+1]
        
        if N <= sum_number:
            print(5 + tunnel + (N // numbers[0]))
            flag = False
            break
            
    if flag:
        print(5 + tunnel + N // numbers[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys, math
input = sys.stdin.readline

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

prev_ceil = math.ceil(N / A2E[0])
ans = prev_ceil
for i in range(1,len(A2E)):
    ans += 1
    prev = A2E[i-1]
    cur = A2E[i]
    current_ceil = math.ceil(N / cur)
    if (prev_ceil < current_ceil):
        delay = int(current_ceil - prev_ceil)
        ans += delay
        prev_ceil = current_ceil

print(int(ans+1))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N = int(input())
abcde = [int(input()) for _ in range(5)]

time = 0
next_n = 0 # 次の駅でまだ残っている人数
last = N # 最後の1回で移動する人数
for i in range(5):
  time += (last + next_n) // abcde[i]
  if (last + next_n) % abcde[i] != 0:
    time += 1

  last = (last + next_n) % abcde[i]
  if last == 0:
    last = min(abcde[i], (last+next_n))

  if i < 4: 
    next_n = max((N-last) - (time-1) * abcde[i+1], 0)


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())

time = 0
cnt = 1
for prev, after in [(A, B), (B, C), (C, D), (D, E), (E, 0)]:
  if prev < N:
    t = N // prev + int(N % prev > 0)
    if prev <= after:
      time += t
      if N % prev:
        N = N % prev
      else:
        N = prev
    else:
      time += t
      if N % prev:
        N = (prev - after) * (time - cnt) + N % prev
      else:
        N = (prev - after) * (time - cnt) + prev
  else:
    time += 1
    if prev > after:
      N = (prev - after) * (time - cnt) + N
  cnt += 1
print(time)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = [int(input()) for i in range(5)]
J = [_ for _ in L if _ != 1]
if min(L) != 1:
    ans = n //min(L) + 5
else:
    if len(J) > 0:
        ans = n // min(J) + n - L.count(1)
    else:
        ans = n - L.count(1)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, A, B, C, D, E = int(input()), int(input()), int(input()), int(input()), int(
    input()), int(input())
ABC = [A, B, C, D, E]
ans = 0
push = N
for i in range(5):
    if push <= ABC[i]:
        ans += 1
    else:
        ans += N // ABC[i] + 1
        push = ABC[i]

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N=int(input())
P=[None]*5
for i in range(5):
    P[i]=int(input())

m = min(P)

if m >= N:
    print(5)
else:
    c = N//m+1
    print(c+4)

Submission status: Wrong Answer

Solution code:
from math import modf

n, a, b, c, d, e = [int(input()) for _ in range(6)]
r = [h for h in [a,b,c,d,e] if h != 1]
if r:
  r = min(r)
else:
  r = 0
if 1 in [a,b,c,d,e]:
  r -= 1
dd, ii = modf(n/r)
ll = int(ii)+int(dd*10)
print(5 if ll <= 0 else ll)

Submission status: Wrong Answer

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

flag=True
for i in A:
  if i<n:
    flag=False
if flag==True:
  print(5)
  exit()

ans=0
if n >A[0]:
  ans+=(n//A[0] if n%A[0] else n//A[0]-1)
  n=A[0]

for a in A[1:]:
  if n>a:
    ans+=(n//a if n%a else n//a-1)
    n=a
print(ans+5)

Submission status: Wrong Answer

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

for i in range(len(l)-1):
    if n > l[i]:
        num = n // l[i]
        if maxNum < num:
            maxNum = num
print(maxNum+5)

Submission status: Wrong Answer

Solution code:
n = int(input())
line = [int(input()) for i in range(5)]
bottoline = line.index(min(sorted(line, reverse=1)))
ans = n // min(line) + 5 - bottoline + [0,1][bottoline != 0]
print(ans)

Submission status: Wrong Answer

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

e = []
for i in range(5):
    e.append(int(N / d[i]))

print(len(e) + max(e))

Submission status: Wrong Answer

Solution code:
import numpy as np

n = []
s = 0
l = int(input())

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

n = np.array(n)
for idx in range(len(n)-1):
    if l % n[idx] == 0:
        k = int(np.floor(l/n[idx]))
    else:
        k = int(np.floor(l/n[idx])+1)
    s += k
#    print(str(idx)+':'+str(l)+';'+str(s))
    if n[idx] < n[idx+1]:
        if l % n[idx] != 0:
            l = l % n[idx]
        else:
            l = n[idx]
    else:
        l -=n[idx+1]*(k-1)

#print(l)
if l % n[4] == 0:
    s += int(np.floor(l/n[4]))
else:
    s += int(np.floor(l/n[4])+1)
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = []
for i in range(5):
  li.append(int(input()))
k = n//li[0]
c = k
d = li[0]
e = n%li[0]
for i in range(1,5):
  if li[i] < d:
    c = k
    k = (e+(d*c)%li[i])//li[i] + (d*c)//li[i]
    e = (e + (d*c)%li[i])%li[i]
    d = li[i]
print(k+5)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = [int(input()) for i in range(5)]
J = [_ for _ in L if _ != 1]
if min(L) != 1:
    ans = n //min(L) + 5
else:
    if len(J) > 0:
        ans = n // min(J) + L.count(1)*n
    else:
        ans = L.count(1)*n
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())
L = [A,B,C,D,E]
L.sort()
K = N // L[0]
M = K + 1
print(M + 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())

sum_time = 0

def calc_time(n, x):
    if n % x == 0:
        res = n // x
    else:
        res = n // x + 1
    return res

sum_time += calc_time(n, a)
if sum_time >= calc_time(n, b) + 1:
    sum_time += 1
else:
    if calc_time(n, b) - 1 < 1:
        sum_time += 1
    else:
        sum_time += calc_time(n, b) - 1
if sum_time >= calc_time(n, c) + 2:
    sum_time += 1
else:
    if calc_time(n, c) - 2 < 1:
        sum_time += 1
    else:
        sum_time += calc_time(n, c) - 2
if sum_time >= calc_time(n, d) + 3:
    sum_time += 1
else:
    if calc_time(n, d) - 3 < 1:
        sum_time += 1
    else:
        sum_time += calc_time(n, d) - 3
if sum_time >= calc_time(n, e) + 4:
    sum_time += 1
else:
    if calc_time(n, e) - 4 < 1:
        sum_time += 1
    else:
        sum_time += calc_time(n, e) - 4
print(sum_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())
saisyo=n+a+b+c+d+e
f=1
g=1
h=1
i=1
j=1
if saisyo>a:
    f=-(-n//a)
    saisyo=a
if saisyo>b:
    g=-(-a//b)
    saisyo=b
if saisyo>c:
    h=-(-b//c)
    saisyo=c
if saisyo>d:
    i=-(-c//d)
    saisyo=d
if saisyo>e:
    saisyo=e
    j=-(-d//e)

goke=f+g+h+i+j

print(goke)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N=int(input())
P=[None]*5
for i in range(5):
    P[i]=int(input())

m = min(P)

c = N//m+1
print(c+4)

Submission status: Wrong Answer

Solution code:
def idou(m, n, i):
    if n[m] != 0:
        if n[m] <= i[m]:
            n[m + 1] += n[m]
            n[m] -= n[m]
        else:
            n[m] -= i[m]
            n[m + 1] += i[m]
    return n


i = []
n = [0] * 6
y = int(input())
for l in range(5):
    i.append(int(input()))
n[0] = y
cnt = 0
if i[0] == min(i):
    if y % i[0] == 0:
        print(int(y / 2) + 4)
    else:
        print(int(y / 2) + 5)
else:
    while True:
        if (n[5] != y):
            for m in range(4, -1, -1):
                n = idou(m, n, i)
            print(n)
            cnt += 1
        else:
            print(cnt)
            break

Submission status: Wrong Answer

Solution code:
N = int(input())
abilities = [int(input()) for _ in range(5)]
min_value = min(abilities)
print((N // min_value) + 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())

time = 0
cnt = 1
for prev, after in [(A, B), (B, C), (C, D), (D, E), (E, 0)]:
  t = N // prev + int(N % prev > 0)
  if prev <= after:
    time += t
    if N % prev:
      N = N % prev
    else:
      N = prev
  else:
    time += t
    if N % prev:
      N = (prev - after) * (time - cnt) + N % prev
    else:
      N = (prev - after) * (time - cnt) + prev
  cnt += 1
print(time)

Submission status: Wrong Answer

Solution code:
n = int(input())
lim = [int(input()) for i in range(5)]
now = [n,0,0,0,0,0]
t = 0
def move(town1,lim,now):
     if now[town1] <= lim[town1]:
          now[town1+1] += now[town1]
          now[town1] = 0
     else:
          now[town1] -= lim[town1]
          now[town1+1] += lim[town1]
     return now

while(t != n):
     for i in range(5):
          now = move(4-i,lim,now)
     t += 1
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())

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

cnt = 5
min = min(list)

x = n // min

print(cnt + x)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = [int(input()) for i in range(5)]
tmp = 0
for i in range(5):
  if l[i] >= N:
    tmp = 1

if tmp == 1:
  print(5)
else:
    ans = 0
    if N%min(l) == 0:
      ans+=5+N//min(l)-1
    else:
      ans+=5+N//min(l)
    print(ans)

Submission status: Wrong Answer

Solution code:
atcoder = [int(input()) for i in range(6)]
loc = [atcoder[0],0,0,0,0,0]

ans = 0

num = 1000000000000000000000
for i in range(1,6):
    if atcoder[i] < num:
        num = atcoder[i]

ans2 = atcoder[0] / num
if atcoder[0] == num:
    print(5)
else:
    print(int(ans2)+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())

temp=[a,b,c,d,e]
temp.sort()
mini=temp[0]

ans=int(n//mini+5)
if mini>=n:
    print("5")
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
numbers = [int(input()) for _ in range(5)]
flag = True

for number in numbers:
    if number < N:
        flag = False
        
if flag:
    print(5)

else:
    sum_number = 0
    tunnel = 0
    flag = True
    
    for i in range(len(numbers)-1):
        sum_number += numbers[i]

        if numbers[i+1] < numbers[i]:
            tunnel += 1
        
        if N < sum_number:
            print(5 + (tunnel - 1) + (N // numbers[0]))
            flag = False
            break
            
    if flag:
        print(5 + tunnel + N // numbers[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
bottle_neck = 10**15+10
for _ in range(5):
    bottle_neck = min(bottle_neck,int(input()))
ans = 5
if bottle_neck<N:
    ans += N//bottle_neck
print(ans)

Submission status: Wrong Answer

Solution code:
N, *capacity = [int(input()) for _ in range(6)]

min_index = capacity.index(min(capacity))

ans = N // capacity[min_index]


print(ans+5)