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:
inputs=[int(input()) for i in range(6)]
N,A,B,C,D,E=inputs
a,b,c,d,e,f=[N,0,0,0,0,0]
T=0

def ship(station,destination,capacity):
    if station>=capacity:
        s=capacity
    else:
        s=station
    destination=destination+s
    station=station-s
    return station,destination

while True:
    if f==N:
        print(T)
        break
    a,b=ship(a,b,A)
    b,c=ship(b,c,B)
    c,d=ship(c,d,C)
    d,e=ship(d,e,D)
    e,f=ship(e,f,E)
    print("{}{}{}{}{}{}".format(a,b,c,d,e,f))
    T=T+1

Submission status: Wrong Answer

Solution code:
inputs=[int(input()) for i in range(6)]
N,A,B,C,D,E=inputs
a,b,c,d,e,f=[N,0,0,0,0,0]
T=0

def ship(station,destination,capacity):
    if station>=capacity:
        s=capacity
    else:
        s=station
    destination=destination+s
    station=station-s
    return station,destination

while True:
    T=T+1
    if f==N:
        print(T)
        break
    e,f=ship(e,f,E)
    d,e=ship(d,e,D)
    c,d=ship(c,d,C)
    b,c=ship(b,c,B)
    a,b=ship(a,b,A)

Submission status: Wrong Answer

Solution code:
from decimal import Decimal

N = Decimal(int(input()))
AtoE = [0]*5
for i in range(5):
  AtoE[i] = int(input())
 
M = Decimal(min(AtoE))
  
print(int(Decimal(N/M)) + 5)

Submission status: Wrong Answer

Solution code:
import math
N = int(input())
data_ls = []
for i in range(5):
    data_ls.append(int(input()))
data_ls.append(0)
memo_ls = [[0 for i in range(6)] for j in range(7)]
memo_ls[0][0] = N
_sum = 0
for i in range(1,6):
    iter = math.ceil(memo_ls[i-1][i-1] / data_ls[i - 1])
    _sum += iter
    for j in range(1,6):
        ct = iter - (j - i + 1)
        if i > j:
            continue
        if ct < 0:
            break
        if memo_ls[i - 1][j - 1] % data_ls[j-1] != 0:
            memo_ls[i][j] = max(0, ct * (data_ls[j - 1] - data_ls[j])) + \
                memo_ls[i-1][j-1] % data_ls[j - 1]
        else:
            memo_ls[i][j] = max(0, ct * (data_ls[j - 1] - data_ls[j])) + data_ls[j - 1]
        memo_ls[i][j] = max(0, memo_ls[i][j])
print(_sum)

Submission status: Wrong Answer

Solution code:
A=list()
for i in range(6):
  A.append(int(input()))
minNum=min(A[0],A[1],A[2],A[3],A[4],A[5])
print(int(A[0]/minNum)+5)

Submission status: Wrong Answer

Solution code:

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

print(n/min(lists) + 4)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
a = []
for _ in range(5):
    a.append(int(input()))
ans = math.floor(n / min(a)) + 5
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
AtoE = [0]*5
for i in range(5):
  AtoE[i] = int(input())
 
M = min(AtoE)
  
print(N//M + 5)

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
a = []
for _ in range(5):
    a.append(int(input()))
if min(a) >= n:
    ans = 5
else:
    ans = math.floor(n / min(a)) + 5
print(ans)

Submission status: Wrong Answer

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

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



print(-(n // min(count_list)-1) + 4)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

M = min(AtoE)
print(int(N/M) + 5)

Submission status: Wrong Answer

Solution code:
n = int(input())
move = [int(input()) for i in range(5)]
men = [n,0,0,0,0,0]
if(min(move)>=n):
    print(5)
else:
    print(round(n/min(move))+4)

Submission status: Wrong Answer

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

print(((N + min_limit - 1) / min_limit) + 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())

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



print(-(n // min(count_list)) + 4)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
l = []

n = int(input())

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

l.sort()

print(int(n/l[0])+5)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
l = []

n = int(input())

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

l.sort()

print(int(n%l[0])+5)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
move = [int(input()) for i in range(5)]
men = [n,0,0,0,0,0]
if(min(move)>=n):
    print(5)
else:
    print(n//min(move)+5)

Submission status: Wrong Answer

Solution code:
n = int(input())
move = [int(input()) for i in range(5)]
men = [n,0,0,0,0,0]
if(min(move)>n):
    print(5)
else:
    print(n//min(move)+5)

Submission status: Wrong Answer

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

M = min(AtoE)
print(int(N/M + 5))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(5):
    p=int(input())
    a.append(p)
q=min(a)
r=0
if n%q==0:
    r=n/q
else:
    r=n//q+1
print(r+5-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
li = [int(input()) for i in range(5)]
ans = 0
tmp = li.index(min(li))
tmp = li[tmp]
ans += (N//tmp)+(5-(li.index(min(li))))
for i in range(0,(li.index(min(li))),1):
    ans += N//li[i]
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math
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 = 4
BIG = N
MIN = S[0]
Mp = 0

for i in range(5):
    if BIG <= S[i]:
        continue
    else :
        BIG = S[i]
        Mp = math.ceil(N / S[i])
        continue
                
ct = ct + Mp

print(ct)

Submission status: Wrong Answer

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

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

m=min(a,b,c,d,e)
print((n//m)+5)

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 = 4
BIG = N
MIN = S[0]
Mp = 0

for i in range(5):
    if BIG <= S[i]:
        continue
    else :
        BIG = S[i]
        Mp = N // S[i] +1
        continue
                
ct = ct + Mp

print(ct)

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()
M = 0
if (L[0] >=N ):
  M = 1
elif(N %L[0] == 0):
  M = N%L[0]
else:
  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())
print(int(5+N/min(A,B,C,D,E)))

Submission status: Wrong Answer

Solution code:
N=int(input())
num = [int(input()) for _ in range(5)]
ans = 4
minnum = min(num)
if N > minnum :
    if N%minnum==0:
        ans = ans + N//minnum
    else:
        ans = ans + N//minnum + 1
print(ans)

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
BIG = N
MIN = S[0]
Mp = 0

for i in range(5):
    if BIG <= S[i]:
        continue
    else :
        BIG = S[i]
        Mp = N // S[i]
        continue
                
ct = ct + Mp

print(ct)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math 

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

time = 0
n = N
last = 0 # 最後の1回で移動する人数
for i in range(5):
  time +=  math.ceil(n / abcde[i])
  last = n % abcde[i]
  if last == 0:
    last = abcde[i]
  if i < 4: 
    n = last + max((time-2) * (abcde[i] - abcde[i+1]), 0)


print(time)

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())
 
#wait = max([math.ceil(n/w) for w in [a,b,c,d,e]])
#print(4 + wait)

wait = max([int(n/w) if n%w!=0 else 0 for w in [a,b,c,d,e]])
print(5 + wait)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from string import ascii_uppercase
import sys, bisect
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]
cap = [read_int()[0] for _ in range(5)]

def solve():
    b_neck = cap[0]
    for i in range(5):
        if b_neck > cap[i]:
            b_neck = cap[i]
    in_neck = N / b_neck
    ans = 4 + in_neck
    return ans

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math 

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

time = 0
n = N
last = 0 # 最後の1回で移動する人数
for i in range(5):
  time +=  math.ceil(n / abcde[i])
  last = n % abcde[i]
  if last == 0:
    last = abcde[i]
  if i < 4: 
    n = last + max((time-1) * abcde[i] - (time-1) * abcde[i+1], 0)


print(time)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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
    print(c+4)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  6 20:39:55 2019

@author: Yamazaki Kenichi
"""
import math

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

neck = min(a,b,c,d,e)
t = math.ceil((N-1)/neck)

print(t + 5)

Submission status: Wrong Answer

Solution code:
import math
import sys

N = int(input())
city_cap = [int(input()) for _ in range(5)]
time = 0
min = float('inf')
min_index = 0

for i in range(5):
    if (min > city_cap[i]):
        min = city_cap[i]
        min_index = i
if (N <= min):
    print('5')
    sys.exit()

cost = 5 + math.floor(N / min)
print(cost)

Submission status: Wrong Answer

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

print(round(n/min(a,b,c,d,e)) +4)

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 :
    Mp = N // S[0]
    f = 1

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

print(ct)

Submission status: Wrong Answer

Solution code:
A = [input() for i in range(5)]
A.sort(key = lambda x:x[-1])
A = [int(a) for a in A]
res = 0
for a in A:
	if a%10 == 0:
		res += a
	else:
		while a%10 != 0:
			a += 1
		res += a 
for a in A:
	if a%10 != 0:
		res -= a%10
		print(res)
		exit()
print(res)

Submission status: Wrong Answer

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

print(round(n/min(a,b,c,d,e) +4))

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())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

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

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



print(n / min(count_list) + 4)

Submission status: Wrong Answer

Solution code:
a = []

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

min_index = a.index(min(a))

sum_minute = N // a[min_index] + 5

print(sum_minute)

Submission status: Wrong Answer

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

time = int(N/min(a))+5
print(time)

Submission status: Wrong Answer

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

print(a // min(b,c,d,e,f) + 5)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import math 

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

time = 0
n = N
last = 0 # 最後の1回で移動する人数
for i in range(5):
  time +=  math.ceil(n / abcde[i])
  last = n % abcde[i]
  if last == 0:
    last = abcde[i]
  if i < 4: 
    n = last + 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())
print(n // min(a,b,c,d,e) + 5)

Submission status: Wrong Answer

Solution code:
import math

N = int(input())
city_cap = [int(input()) for _ in range(5)]
time = 0
min = float('inf')
min_index = 0

for i in range(5):
    if (min > city_cap[i]):
        min = city_cap[i]
        min_index = i

cost = 5 + math.floor(N / min)
print(cost)

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 + 1)
    elif a == lst[1]:
        print(ret + 2)
    elif a == lst[2]:
        print(ret + 3)
    elif a == [3]:
        print(ret + 4)
    else:
        print(ret + 5)

Submission status: Wrong Answer

Solution code:
N, A, B, C, D, E = int(input()), int(input()), int(input()), int(input()), int(
    input()), int(input())
Min = min([A, B, C, D, E])
print(N // Min + 5)

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 :
    Mp = N // S[0]
    f = 1

for i in range(4):
    if f == 0 and N <= S[i+1] :
        continue
    elif f == 0 and N > S[i+1]:
        f = 1
        Mp = N // S[i+1]
        MIN = S[i+1]
    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 sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, A, B, C, D, E = [INT() for _ in range(6)]
trans = [A, B, C, D, E]
num_city = [N, 0, 0, 0, 0, 0]
time = 0
for i in range(5):
	if not i==4:
		tmp = num_city[i]%trans[i]
		num_city[i+1] = N-tmp
		if N-tmp <= trans[i+1]*((time+(ceil(num_city[i]/trans[i])))-(i+1)):
			num_city[i+1] = 0
		else:
			num_city[i+1] -= trans[i+1]*((time+(ceil(num_city[i]/trans[i])))-(i+1))
		num_city[i+1] += tmp
		time += ceil(num_city[i]/trans[i])
		num_city[i] = 0
	else:
		time += ceil(num_city[4]/E)
print(time)

Submission status: Wrong Answer

Solution code:
#n=int(input())
#li=input().split()
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
import math
#li=list(map(int,input().split()))
#S=input()

lis=[]
t=[0,0,0,0,0]
ans=0
for i in range(6):
    lis.append(int(input()))

t[0]=math.ceil(lis[0]/lis[1])
ans=t[0]
for i in range(1,5):
    if lis[i+1]>=lis[i]:
        t[i]=t[i-1]
        ans+=1
    else:
        t[i]=math.ceil((lis[0]-lis[i+1]*(t[i-1]-1))/lis[i+1])
        ans+=t[i]   
print(ans)

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 + 2)
    else:
        print(ret + 1)

Submission status: Wrong Answer

Solution code:
""""
C - Five Transportations
https://atcoder.jp/contests/abc123/tasks/abc123_c
"""
if __name__ == '__main__':
    n = int(input())
    a = int(input())
    b = int(input())
    c = int(input())
    d = int(input())
    e = int(input())

    pop_list = [n, 0, 0, 0, 0, 0]
    i = 0

    while pop_list[5] < n:
        i += 1
        move0to1 = max(pop_list[0] - a, a) if pop_list[0] > a else pop_list[0]
        move1to2 = max(pop_list[1] - b, b) if pop_list[1] > b else pop_list[1]
        move2to3 = max(pop_list[2] - c, c) if pop_list[2] > c else pop_list[2]
        move3to4 = max(pop_list[3] - d, d) if pop_list[3] > d else pop_list[3]
        move4to5 = max(pop_list[4] - e, e) if pop_list[4] > e else pop_list[4]

        pop_list[0] = pop_list[0] - move0to1
        pop_list[1] = pop_list[1] + move0to1 - move1to2
        pop_list[2] = pop_list[2] + move1to2 - move2to3
        pop_list[3] = pop_list[3] + move2to3 - move3to4
        pop_list[4] = pop_list[4] + move3to4 - move4to5
        pop_list[5] = pop_list[5] + move4to5

    print(i)

Submission status: Wrong Answer

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

print(N//s_min + 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())
L = [A,B,C,D,E]
L.sort()
M = 0
if (L[0] >= N):
  M = 1
else:
  K = N // L[0]
  M = K + 1
print(M + 4)

Submission status: Wrong Answer

Solution code:
a = []

for i in range(6):
    a.append(int(input()))

if a[0] <= a[1]:
    sum_minute = 1
else:
    sum_minute = -(-a[0] // a[1])

b = []
for i in range(5):
    b.append(a[i+1])

min_in = b.index(min(b)) + 1
min_in = max(min_in , 3)


for i in range(2,min_in):
    if a[i - 1] <= a[i]:
        m = 1
    else:
        m = -(-(a[0] - (sum_minute - i + 1) * a[i]) // a[i])
    sum_minute += m

for i in range(min_in, 6):
    sum_minute += 1

print(sum_minute)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
F=min(A,B,C,D,E)
if N/F==0:
    print((N//F)+4)
else:
    print(((N//F)+1)+4)

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 = (N//minT) + 5

print(time)

Submission status: Wrong Answer

Solution code:
from math import*
n = int(input())
L = [int(input()) for i in range(5)]
ans = ceil(n%min(L)) + 4
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())
ABC = [N,0,0,0,0]
time = 0
flag = 0
i = 0
while ABC[4] > 0 or flag == 0:
    print(ABC)
    if i >= 4:
        if ABC[4] >= E:
            ABC[4]-=E
        else:
            ABC[4]=0
    if i >= 3:
        if ABC[3] >= D:
            ABC[3]-=D
            ABC[4]+=D
            flag = 1
        else:
            ABC[4]+=ABC[3]
            flag = 1
            ABC[3]=0
    if i >= 2:
        if ABC[2] >= C:
            ABC[2]-=C
            ABC[3]+=C
        else:
            ABC[3]+=ABC[2]
            ABC[2]=0
    if i >= 1:
        if ABC[1] >= B:
            ABC[1]-=B
            ABC[2]+=B
        else:
            ABC[2]+=ABC[1]
            ABC[1]=0
    if ABC[0] >= A:
        ABC[0]-=A
        ABC[1]+=A
    else:
        ABC[1]+=ABC[0]
        ABC[0]=0
        
        
    time += 1
    i += 1
print('end',ABC)
print(time)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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 :
    Mp = 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
N = int(input())
li = list()

for _ in range(5):
  li.append(int(input()))
ans = N
aa = 0
ll = list()
for i in range(5):
  ak = ans // li[i]
  ll.append(li[i])
  aa += math.ceil(ak)
  
  if ak != 0 and i != 4:
    if min(ll) > li[i+1]:
      ans = N-(li[i+1]*(aa-i-1))
    else:
      ans = N-(min(ll)*(aa-i-1))
print(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())

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


time += N//min_move 

print(time)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
N = int(input())
l = []
for i in range(5):
    l.append(int(input()))
print(N // min(l) + 4 if N % l[i] == 0 else N // min(l) + 5)

Submission status: Wrong Answer

Solution code:
a = []

for i in range(6):
    a.append(int(input()))

if a[0] <= a[1]:
    sum_minute = 1
else:
    sum_minute = -(-a[0] // a[1])

b = []
for i in range(5):
    b.append(a[i+1])

min_in = b.index(min(b)) + 1
min_in = min(min_in , 2)


for i in range(2,min_in):
    if a[i - 1] <= a[i]:
        m = 1
    else:
        m = -(-(a[0] - (sum_minute - i + 1) * a[i]) // a[i])
    sum_minute += m

for i in range(min_in, 6):
    sum_minute += 1

print(sum_minute)

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
a = []
 
for i in range(5):
    a.append(int(input()))
 
print(str(math.floor(n/min(a))+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())

A=[]
A.append(a)
A.append(b)
A.append(c)
A.append(d)
A.append(e)

A.sort()
m=A[0]
if n%m==0:
    ans = n/m + 4
else:
    ans = n/m + 4 + 1
#print(int(n/m))
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
li = []

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

ans = 0
if N % min(li) == 0:
    ans += N // min(li)
else:
    ans += N // min(li) + 1
    print(ans+4)

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:

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

A=[]
A.append(a)
A.append(b)
A.append(c)
A.append(d)
A.append(e)

A.sort()
m=A[0]
if n/m==0:
    ans = n/m + 4
else:
    ans = n/m + 4 + 1
#print(int(n/m))
print(ans)
#100000000000000000000000000000000000000000000000000
#100000000000000007629769841091887003294964970946565

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [0] * 5
A[0] = int(input())
A[1] = int(input())
A[2] = int(input())
A[3] = int(input())
A[4] = int(input())
mi = 0
mA = 1e18
for i in range(0,5):
    if (A[i] < mA):
        mA = A[i]
        mi = i
print(((N + mA - 1) // mA) * (mi + 1) + 4)

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 cities[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:
import math

n = int(input())
l = [int(input()) for _ in range(5)]
ans = 0

tmp = n

necks = []
for i in range(5):
    neck = math.ceil(tmp/l[i])
    necks.append(neck)
    tmp = l[i]

before = 0
f = True
for neck in necks:
    if neck < before:
        f = False

    if f:
        if neck >= before:
            ans += neck
            before = neck
        else:
            ans += 1
    else:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
a = []

for i in range(6):
    a.append(int(input()))

if a[0] <= a[1]:
    sum_minute = 1
else:
    sum_minute = -(-a[0] // a[1])

b = []
for i in range(5):
    b.append(a[i+1])

min_in = b.index(min(b))
min_in = min(min_in , 2)

for i in range(2,min_in):
    if a[i - 1] <= a[i]:
        m = 1
    else:
        m = -(-(a[0] - (sum_minute - i + 1) * a[i]) // a[i])
    sum_minute += m

for i in range(min_in, 6):
    sum_minute += 1

print(sum_minute)

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 == d[0] and N == d[1] and N == d[2] and N == d[3] and N == d[4]:
    print(len(e))
    exit()

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

Submission status: Wrong Answer

Solution code:
import math

n = int(input())
l = [int(input()) for _ in range(5)]
ans = 0

tmp = n

necks = []
for i in range(5):
    neck = math.ceil(tmp/l[i])
    necks.append(neck)
    print(neck)
    tmp = l[i]

before = 0
f = True
for neck in necks:
    if neck < before:
        f = False

    if f:
        if neck >= before:
            ans += neck
            before = neck
        else:
            ans += 1
    else:
        ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline

n = int(input())

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

p = n
lis1 = []

for i in range(5):
    if (lis[i] < p):
        lis1.append(i)
        p = lis[i]

if(len(lis1) > 0):
    print(int(n/lis[lis1[-1]])-1+(n % lis[lis1[-1]])+5)
else:
    if (n > lis[0]):
        if(n % lis[0] != 0):
            print(5 + int(n / lis[0]))
        else:
            print(5 + int(n / lis[0]) - 1)
    else:
        print(5)

Submission status: Wrong Answer

Solution code:
n = int(input())

trans = int(1e+15)
for _ in range(5):
    tmp = int(input())
    if tmp < trans:
        trans = tmp

if trans > n:
    print(5)
else:
    print(4 + int(n / trans + 0.5))

Submission status: Wrong Answer

Solution code:
N = int(input())
li = list()

for _ in range(5):
  li.append(int(input()))
ans = N
aa = 0
ll = list()
for i in range(5):
  ak = ans // li[i]
  ll.append(li[i])
  aa += ak+1
  
  if ak != 0 and i != 4:
    if min(ll) > li[i+1]:
      ans = N-(li[i+1]*(aa-i-1))
    else:
      ans = N-(min(ll)*(aa-i-1))
print(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())
T=[E,D,C,B,A]

time=0
initial=0
p=[0]*6
p[5]=N
m=min(T)
if m>=N:
    print(5)
else:
    print(N//m+5)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = [int(input()) for i in range(5)]
ans = n //min(L) + 4
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())
T=[E,D,C,B,A]

time=0
initial=0
p=[0]*6
p[5]=N
m=min(T)
if m>N:
    print(5)
else:
    print(N//m+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())
 
wait = max([int(n/w) if n!=w else 0 for w in [a,b,c,d,e]])
print(5 + wait)