Problem:


Score: 200 points

Problem Statement

The restaurant AtCoder serves the following five dishes:

ABC Don (rice bowl): takes A minutes to serve.

ARC Curry: takes B minutes to serve.

AGC Pasta: takes C minutes to serve.

APC Ramen: takes D minutes to serve.

ATC Hanbagu (hamburger patty): takes E minutes to serve.

Here, the time to serve a dish is the time between when an order is placed and when the dish is delivered.

This restaurant has the following rules on orders:

An order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).

Only one dish can be ordered at a time.

No new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.

E869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.

Here, he can order the dishes in any order he likes, and he can place an order already at time 0.

Constraints

A, B, C, D and E are integers between 1 and 123 (inclusive).

Input

Input is given from Standard Input in the following format:

A
B
C
D
E

Output

Print the earliest possible time for the last dish to be delivered, as an integer.

Sample Input 1

29
20
7
35
120

Sample Output 1

215

If we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:

Order ABC Don at time 0, which will be delivered at time 29.

Order ARC Curry at time 30, which will be delivered at time 50.

Order AGC Pasta at time 50, which will be delivered at time 57.

Order ATC Hanbagu at time 60, which will be delivered at time 180.

Order APC Ramen at time 180, which will be delivered at time 215.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 2

101
86
119
108
57

Sample Output 2

481

If we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:

Order AGC Pasta at time 0, which will be delivered at time 119.

Order ARC Curry at time 120, which will be delivered at time 206.

Order ATC Hanbagu at time 210, which will be delivered at time 267.

Order APC Ramen at time 270, which will be delivered at time 378.

Order ABC Don at time 380, which will be delivered at time 481.

There is no way to order the dishes in which the last dish will be delivered earlier than this.

Sample Input 3

123
123
123
123
123

Sample Output 3

643

This is the largest valid case.



Sample input:
29
20
7
35
120


Sample output:
215

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]

for i in range(len(li)):
    if li[i]%10 != 0:
        if li[i]%10 == min([x%10 if x%10 != 0 else 10 for x in li]):
            N = i+0
            break
else:
    N = 0


for j in range(len(li)):
    if j == N:
        continue
    elif li[j]%10 != 0:
        li[j] += 10 - li[j]%10

print(sum(li))

Submission status: Accepted

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

b = []

for i in a:
    n = i % 10
    b.append(n)
sum = 0
if b == [0,0,0,0,0]:
    for j in a:
        sum += j
    print(sum)
else:
    c = [i for i in b if i > 0]
    c.sort()

    for j in a:
        sum += j
 
    n = 0
    for k in c:
        n += 10 - k

    N = sum + n + (c[0] - 10)
    print(N)

Submission status: Accepted

Solution code:
import math
from functools import reduce
l = [int(input()) for _ in range(5)]
r = 9
n = 0
for i, j in zip([I % 10 for I in l], range(5)):
    if i != 0 and i < r:
        r = i
        n = j
ceil = lambda n: math.ceil(n / 10) * 10
print(l.pop(n) + reduce(lambda a, b: ceil(a) + ceil(b), l))

Submission status: Accepted

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


l = [A, B, C, D, E]
l2 = list()

# check min 1 keta

m = -1

for x in l:
    t = int(x) % 10
    if t == 0:
        l2.append(int(x))
    else:
        l2.append((int(x) + 10) // 10 * 10)

l3 = [int(x) % 10 for x in l]
l3 = [x for x in l3 if x != 0]

if len(l3) == 0:
    print(sum(l2))
else:
    print(sum(l2) - 10 + min(l3))

Submission status: Accepted

Solution code:
x = [input() for _ in range(5)]
t = 9
fl = False
digits = 0
for idx, i in enumerate(x):
	i = str(int(i) + 10)
	digits = len(i)
	a = int(i[-1])
	if a != 0:
		if t >= a:
			t = a
			fl = True
		if digits == 1:
			x[idx] = "10"
		elif digits == 2:
			x[idx] = "".join((i[-2], "0"))
		else:
			x[idx] = "".join((i[-3], i[-2], "0"))
if not fl: t = 10
print(sum([int(_) for _ in x]) - 10 + t)

Submission status: Accepted

Solution code:
abcde = list()
ans = 99999
flag = True

for i in range(5):
    abcde.append(int(input()))
    
for i in range(5):
    p_ans = 0
    p_ans += abcde[i]
    for j in range(5):
        if i != j:
            if abcde[j] % 10 == 0: p_ans += abcde[j]
            else:p_ans += abcde[j] + (10 - abcde[j] % 10)
    if ans > p_ans:
        ans = p_ans
print(ans)

Submission status: Accepted

Solution code:
a = [int(input())  for i in range(5)]
def amari(num):
    return num % 10
b = list(map(amari, a))
b_r = [10 if i == 0 else i for i in b]
d = min(b_r)
c = sum(a) - sum(b_r) + 40 + d
print(c)

Submission status: Accepted

Solution code:
times = [int(input()) for _ in range(5)]
diff = [False for i in range(10)]
for time in times:
    diff[time%10]=True
res = 0
for i in range(1, 10):
    if diff[i]:
        res=i
        break
else:
    res=10

for i in range(5):
    rep = times[i]//10
    if times[i]%10!=0:
        rep+=1
    times[i] = rep*10

print(sum(times) - (10 - res))

Submission status: Accepted

Solution code:
# coding=utf-8

# write code...
import math

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
List1=[a,b,c,d,e]
List2=[(a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10]

# List.index()で()内の値を探す。↓の場合最小値を含むリストのインデックスを探索
index=List2.index(min(List2))

# math.ceil切り上げ。全部切り上げて、一番待ち時間が長いものだけを引いて
ans = math.ceil(a/10)+math.ceil(b/10)+math.ceil(c/10)+math.ceil(d/10)+math.ceil(e/10)-math.ceil(List1[index]/10)+List1[index]/10
ans = int(ans*10)

print(ans)

Submission status: Accepted

Solution code:
k = 0
m = 0
for i in range(5):
    a = int(input())
    k += a + (10 - a%10)%10
    m = max(m, (10 - a%10)%10)
print(k-m)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
b = [(x % 10, x) for x in a]
b.sort()
ans = 0
flag = True
for c in b:
    if c[0] == 0:
        ans += c[1]
    else:
        if flag:
            flag = False
            ans += c[1]
        else:
            ans += c[1] - c[0] + 10
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

A = [input() for i in range(5)]
m = 9
flag = True
for a in A:
    if int(a[-1]) == 0:
        pass
    elif int(a[-1]) <= m:
        flag = False
        m = int(a[-1])
        min_dish = a
B = [int(i) for i in A]
if flag:
    min_dish = str(min(B))
sum = int(min_dish)
A.remove(min_dish)
for a in A:
    if int(a[-1]) == 0:
        sum += int(a)
    else:
        sum += int(a) + int(10) - int(a[-1])
print(int(sum))

Submission status: Accepted

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

time = []

for i in range(5):
  time.append(0)
  while (times[i] + time[i]) % 10 != 0:
    time[i] += 1

print(sum(times)+sum(time)-max(time))

Submission status: Accepted

Solution code:
t=[]
for _ in range(5):
    t.append(int(input()))
d=[0]*5
tt = [0]*5
for i in range(5):
    d[i] = t[i]%10 if t[i] %10!=0 else 10
    tt[i] =t[i]//10+1 if t[i]%10!=0 else t[i]//10
print(sum(tt)*10-10+min(d))

Submission status: Accepted

Solution code:
li = [int(input()) for i in range(5)]
al = []
ans = 0
for i in li:
  if i % 10 != 0:
    al.append(i % 10) 
  ans += i // 10
ans *= 10
if len(al) > 0:
  ans += min(al) + (len(al) - 1)*10
print(ans)

Submission status: Accepted

Solution code:
l = [input() for i in range(5)]

a = 10
y = 0
for i in range(5):
  s = int(l[i]) % 10
  if a > s & s != 0:
    a = s
    y = i
    
sum = 0
for i in range(5):
  if y == i:
    sum += int(l[y])
  else:
    sum += int(l[i])
    if int(l[i])%10 != 0:
      sum += (10 - (int(l[i])%10))
print(sum)

Submission status: Accepted

Solution code:
a = [float(input()) for i in range(5)]
sum = 0
amari = 10
index = 0
for i in range(5):
    if a[i] % 10 < amari and a[i] % 10 != 0:
        index = i
        amari=a[i] % 10
        # print(index)
# print(index)
for i in range(5):
    if i == index:
        pass
    else:
        if a[i] % 10 != 0:
            sum += a[i]+10 - a[i] % 10
        else:
            sum += a[i]
sum += a[index]
print(int(sum))

Submission status: Accepted

Solution code:
def f(v):
	y=0
	for x in v:y=(y+9)//10*10+x
	return y
print(min(f(x)for x in __import__('itertools').permutations(int(input())for _ in[0]*5)))

Submission status: Accepted

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

f=0
g=[a%10,b%10,c%10,d%10,e%10]
saisyo=10

f+=math.ceil(a/10)*10
f+=math.ceil(b/10)*10
f+=math.ceil(c/10)*10
f+=math.ceil(d/10)*10
f+=math.ceil(e/10)*10

for i in g:
    if 0<i<saisyo:
        saisyo=i
        

print(f-10+saisyo)

Submission status: Accepted

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

AA = int(A)
BB = int(B)
CC = int(C)
DD = int(D)
EE = int(E)

a = A[-1]
b = B[-1]
c = C[-1]
d = D[-1]
e = E[-1]

aa = int(a)
bb = int(b)
cc = int(c)
dd = int(d)
ee = int(e)

data = [aa ,bb, cc, dd, ee]
def func(x):
    if(x==0): return False
    else: return True
    
filtered = filter(func, data)

if aa==bb==cc==dd==ee==0:
    kk =int(10)
else:
    kk = min (filtered)

n = int(0)

if aa == 0 :
    n = n+AA
else:
    n = n+AA+10-aa
if bb == 0 :
    n = n+BB
else:
    n = n+BB+10-bb
if cc == 0 :
    n = n+CC
else:
    n = n+CC+10-cc
if dd == 0 :
    n = n+DD
else:
    n = n+DD+10-dd
if ee == 0 :
    n = n+EE
else:
    n = n+EE+10-ee
print(n+kk-10)

Submission status: Accepted

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

a = 10 - (A % 10)
if a == 10:
    a = 0
b = 10 - (B % 10)
if b == 10:
    b = 0    
c = 10 - (C % 10)
if c == 10:
    c = 0
d = 10 - (D % 10)
if d == 10:
    d = 0
e = 10 - (E % 10)
if e == 10:
    e = 0
f = max(a, b, c, d, e)
print(A + B + C + D + E + a + b + c + d + e - f)

Submission status: Accepted

Solution code:
import sys
import numpy as np

a_t=int(input())
b_t=int(input())
c_t=int(input())
d_t=int(input())
e_t=int(input())

a_d = a_t % 10
b_d = b_t % 10
c_d = c_t % 10 
d_d = d_t % 10
e_d = e_t % 10

dish_d = np.zeros(5)
dish_d[0] = a_d
dish_d[1] = b_d
dish_d[2] = c_d
dish_d[3] = d_d
dish_d[4] = e_d

if any(dish_d) == 0:
    time = (
        a_t // 10 + np.where(a_d==0, 0, 1) \
        + b_t  // 10 + np.where(b_d==0, 0, 1) \
        + c_t // 10 + np.where(c_d==0, 0, 1) \
        + d_t // 10 + np.where(d_d==0, 0, 1) \
        + e_t // 10 + + np.where(e_d==0, 0, 1)
       ) * 10
else:
    time = (
            a_t // 10 + np.where(a_d==0, 0, 1) \
            + b_t  // 10 + np.where(b_d==0, 0, 1) \
            + c_t // 10 + np.where(c_d==0, 0, 1) \
            + d_t // 10 + np.where(d_d==0, 0, 1) \
            + e_t // 10 + + np.where(e_d==0, 0, 1)
           ) * 10 - (10 - np.min(dish_d[np.nonzero(dish_d)]))
print(int(time))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a,b,c,d,e]
h = 0
j =[]
for i in range(0, 5):
    f = l[i] // 10
    g = l[i] % 10
    if not(g == 0):
        f = f + 1
        j.append(g)
    f = f * 10
    h = h + f
    
if not(j == []):
    h = h + min(j) -10
print(h)

Submission status: Accepted

Solution code:
def f(v):
	y=0
	for x in v:y=(y+9)//10*10+x
	return y
print(min(f(x) for x in __import__('itertools').permutations(int(input())for _ in[0]*5)))

Submission status: Accepted

Solution code:
import math
from functools import reduce
l = [int(input()) for _ in range(5)]
ans = 9
n = j = 0
for i in [I % 10 for I in l]:
    if i != 0 and i < ans:
        ans = i
        n = j
    j += 1
ceil = lambda n: math.ceil(n / 10) * 10
print(l.pop(n) + reduce(lambda a, b: ceil(a) + ceil(b), l))

Submission status: Accepted

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

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

G = []

A=a%10
B=b%10
C=c%10
D=d%10
E=e%10

G.append(A)
G.append(B)
G.append(C)
G.append(D)
G.append(E)

min_except0 = G[:]

for i in range(4):
    try:
        min_except0.remove(0)
    except:
        pass
x = G.index(min(min_except0))

loop = [0,1,2,3,4]
loop.remove(x)

answer = 0
for i in loop:
  answer += g[i]
  answer += 10-G[i]
answer += g[x]

minas = 10*(5 - len(min_except0))

answer -= minas

print(answer)

Submission status: Accepted

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

a1=int((a-1)/10)+1
b1=int((b-1)/10)+1
c1=int((c-1)/10)+1
d1=int((d-1)/10)+1
e1=int((e-1)/10)+1

min = min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)
  
def time():
  
  return(a1*10+b1*10+c1*10+d1*10+e1*10+min-9)
  

print(time())

Submission status: Accepted

Solution code:
order = [int(input()) for _ in range(5)]
min_digit = 9
time = 0
for i in range(len(order)):
  if order[i]%10!=0:
    time+=(order[i]//10+1)*10
  else:
    time+=order[i]

for i in range(len(order)):
  digit = order[i]%10
  if min_digit>=digit and digit!=0:
    min_digit=digit
    
order_digit = [i%10 for i in order]
if order_digit == [0,0,0,0,0]:
  print (time)
else:
  print (time-10+min_digit)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
sum = 0
smallnum = 10

listX = [A, B, C, D, E]

for i in listX:
    if i % 10 == 0:
        sum += i
    else:
        if i % 10 < smallnum:
            smallnum = i % 10
        sum += (10 + i - i%10)

print(sum + smallnum - 10)

Submission status: Accepted

Solution code:
import itertools
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
lists = [A,B,C,D,E]
time = 0
min = 9999
for i,j,k,m,n in itertools.permutations(lists):
        menu_list = [i,j,k,m,n]
        time = 0
        for l in range(5):
                time += menu_list[l]
                if time % 10 != 0 and l != 4:
                         time = (time - (int(time % 10))) + 10
                else:
                        continue
        if min > time:
                min = time
print(min)

Submission status: Accepted

Solution code:
import copy
def mise(times, temp, time, n):
    mise_time = 1000
    n += 1
    time1 = time
    for i in range(len(temp)):
        temp1 = copy.copy(temp)
        time1 = time
        time1 += temp1.pop(i)
        if n == len(times):
            return time1
        while True:
            if time1 % 10 == 0:
                break
            time1 += 1
        temp_time = mise(times, temp1, time1, n)
        if temp_time < mise_time:
            mise_time = temp_time
    return mise_time

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

times = [a, b, c, d, e]
timess = 1000
for i in range(len(times)):
    time = 0
    temp = copy.copy(times)    
    temp_time = mise(times, temp, time, 0)
    if temp_time < timess:
        timess = temp_time
print(timess)

Submission status: Accepted

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

mod_list = []

a_mod = a % 10
if a_mod == 0:
    a_total = a
else:
    a_total = a + (10 - a_mod)
    mod_list.append(a_mod)

b_mod = b % 10
if b_mod == 0:
    b_total = b
else:
    b_total = b + (10 - b_mod)
    mod_list.append(b_mod)

c_mod = c % 10
if c_mod == 0:
    c_total = c
else:
    c_total = c + (10 - c_mod)
    mod_list.append(c_mod)

d_mod = d % 10
if d_mod == 0:
    d_total = d
else:
    d_total = d + (10 - d_mod)
    mod_list.append(d_mod)

e_mod = e % 10
if e_mod == 0:
    e_total = e
else:
    e_total = e + (10 - e_mod)
    mod_list.append(e_mod)

min_mod = 0
if len(mod_list) != 0:
    min_mod = min(mod_list)

if min_mod == 0:
    cut_time = 0
else:
    cut_time = 10 - min(mod_list)

print(a_total + b_total + c_total + d_total + e_total - cut_time)

Submission status: Accepted

Solution code:
#１のくらいのみ見れはいい？
import numpy as np
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ls=[a,b,c,d,e]
ls_1=[]
for i in range(len(ls)):
    ls_1.append(int(str(ls[i])[-1]))
ls_1=np.array(ls_1)
ls_1_10=10-ls_1
ls_1_10[ls_1_10==10]=0
#ls_1_10=ls_1[ls_1 < 10]#１０を除いたロス
a=np.argmax(ls_1_10)#最大の１の位を探す
ls_non=np.delete(ls_1_10, a, 0)
#ls_non_10=ls_non[ls_non < 10]
ls=np.array(ls)
ans=np.sum(ls) + np.sum(ls_non)
print(ans)

Submission status: Accepted

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

lm = 10
at = 0
t = 0
count = 0
for j in range(5):
    t,l = divmod(M[j],10)
    if lm > l and l != 0:
        lm = l
        at += t * 10
        count += 1
    elif l == 0:
        at += t * 10
    else:
        at += t * 10
        count += 1

at += lm + (10 * (count - 1))
print(at)

Submission status: Accepted

Solution code:
A = input()
B = input()
C = input()
D = input()
E = input()
L = [A,B,C,D,E]
#L_s = str(L)
m=9
for i in L:
    if(i[-1]!="0"):
        m=min(m,int(i[-1]))

ans=0
flag=1
for i in L:
    if(i[-1]==str(m) and flag):
        ans+=int(i)
        flag=0
        #print(i)
    else:
        ans+=int(i)
        if(i[-1]!="0"):
            ans+=10-int(i[-1])
print(ans)

Submission status: Accepted

Solution code:
import math 
a = [int(input())for i in range(5)]
rest = []
t = 0
for i in a:
  if i%10 == 0 :
    t+=i
  else:
    rest.append(i)
if rest == [] :
  print(t)
else :
  f = sorted(rest, key=lambda x:str(x)[-1] ,reverse=True)
  c = [math.ceil(i/10)*10for i in f[:-1]]
  t += sum(c)+f[-1]
  print(t)

Submission status: Accepted

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

amarino_times = [i % 10 for i in times]
#
# min_index = amarino_times.index(min(amarino_times))
#
# last_choose_time = times.pop(min_index)
#
#
# sum = 0
# for i in times:
#     sum += i
#     if i % 10 != 0:
#         sum += 10 - (i % 10)
#
# sum += last_choose_time
#
# hoge = 0
# for i in amarino_times:
#     if i == 0:
#         hoge += 1
# for i in range(hoge):
#     fuga = amarino_times.pop(amarino_times.index(min(amarino_times)))
# print(hoge)
# if hoge:
#     sum -= min(amarino_times)
#
#
# print(sum)

sum = 0
for i in times:
    if i % 10 == 0:
        sum += i
    else:
        sum += i + 10-i % 10

hoge = []
for i in range(len(amarino_times)):
    if amarino_times[i] != 0:
        hoge.append(amarino_times[i])

if any(amarino_times):
    sum -= (10-min(hoge))

print(sum)

Submission status: Accepted

Solution code:
import math
List=[int(input()) for i in range(5)]
t = 0
min_q = 99
for i in range(5):
  q = List[i]%10
  t += math.ceil(List[i]/10)*10
#  print(t,q)
  if q >0:
    min_q = min(min_q, q)
if min_q != 99:
  t -= 10 - min_q
print(t)

Submission status: Accepted

Solution code:
import itertools
List=[int(input()) for i in range(5)]
List_2=list(itertools.permutations(List))
min = 100000
count = 0
for i in List_2:
  time = 0
  for j in i:
    if count != 4:
      time += j
      if time % 10 != 0:
        time = ((time // 10) + 1) * 10  
      count += 1
    elif count == 4 :
      time += j
      count = 0
  if time < min:
    min = time
print(min)

Submission status: Accepted

Solution code:
li = [str(input()) for i in range(5)]
tmp = []
tmp_2 = []
s = 0
for i in range(5):
    if 10-int(li[i][-1]) != 10:
        tmp.append(10-int(li[i][-1]))
    tmp_2.append(int(li[i]))
tmp.sort()
if len(tmp) != 0:
    print(sum(tmp_2)+(sum(tmp)-tmp[-1]))
else:
    print(sum(tmp_2))

Submission status: Accepted

Solution code:
li = []
l = []
for i in range(5):
    a = int(input())
    li.append(a)
    if a % 10 != 0:
        l.append(a%10)
    else:
        l.append(10)
ind = l.index(min(l))
ans = 0
for i in range(5):
    if i != ind and i != 10:
        ans += (li[i] + 10 - l[i])
    elif i != ind and i == 10:
        ans += (li[i] - l[i])
print(ans+li[ind])

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
b=[a[i]%10 for i in range(5)]
c= sorted(b)
for i in range(5):
	if c[i]!=0:
		for j in range(5):
			if c[i]==b[j]:
				d=j
		break
for i in range(5):
	if a[i]%10 !=0 and i!=d:
		while True:
			a[i]=a[i]+1
			if a[i] % 10==0:
				break
print(sum(a))

Submission status: Accepted

Solution code:
import math
import itertools
inputs = [input() for i in range(5)]
nl = [0, 1, 2, 3, 4]
l = list(itertools.permutations(nl))
t = 0
ans = -1
for li in l:
    for a in li:
        t = (math.ceil((t)/10)) * 10 + int(inputs[a])
    if ans == -1 or t < ans:
        ans = t
        c = li
    t = 0
print(ans)

Submission status: Accepted

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

if a%10!=0:
	a0 = a + ( 10 - a%10 )
else:
	a0 = a


if b%10!=0:
	b0 = b + ( 10 - b%10 )
else:
	b0 = b  
    
if c%10!=0:
	c0 = c + ( 10 - c%10 )
else:
	c0 = c
  
if d%10!=0:
	d0 = d + ( 10 - d%10 )
else:
	d0 = d
  
  
if e%10!=0:
	e0 = e + ( 10 - e%10 )
else:
	e0 = e


if a%10 != 0:
    a1 = 10 - a%10
else:
  	a1 = 0
    
if b%10 != 0:
    b1 = 10 - b%10
else:
  	b1 = 0
    
if c%10 != 0:
    c1 = 10 - c%10
else:
  	c1 = 0
    
if d%10 != 0:
    d1 = 10 - d%10
else:
  	d1 = 0
    
if e%10 != 0:
    e1 = 10 - e%10
else:
  	e1 = 0

l = max([a1, b1, c1, d1, e1])
	

print(a0+b0+c0+d0+e0-l)

Submission status: Accepted

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

l = [A, B, C, D, E]
min = 129
count = 0

for ll in l:
    if ll % 10 <= min % 10 and ll % 10 != 0:
        if min != 129:
            count += (int(min / 10) + 1) * 10
        
        min = ll
    
    else:
        if ll % 10 == 0:
            count += ll
        else:
            count += (int(ll / 10) + 1) * 10
    
if min == 129:
    print(count)
else:
    print(count + min)

Submission status: Accepted

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

counter = 0
lst_wait = []
for k in range(5):
    time_wait = lst[k] % 10
    if time_wait % 10 == 0:
        wait_time = 0
        lst_wait.append(wait_time)
    else:
        wait_time = 10 - time_wait
        lst_wait.append(wait_time)
    
lst_com = list(zip(lst_wait,lst))
lst_com_ch = sorted(list(lst_com))
total_time = 0

for i in range(4):
    total_time = total_time + list(lst_com_ch)[i][0] +list(lst_com_ch)[i][1]

total_time += list(lst_com_ch)[4][1]

print(total_time)

Submission status: Accepted

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


def solve(l, t):
    global ans
    if len(l) == 0:
        if ans > t:
            ans = t
        return
    if t % 10 > 0:
        t = t+10-t % 10
    for i, v in enumerate(l):
        solve(l[:i]+l[i+1:], t+l[i])


solve(a, 0)
print(ans)

Submission status: Accepted

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

import sys

debug = False

def log(text):
    if debug:
        print(text)


def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    a_e = [int(e) for e in lines[:5]]

    return (a_e,)

def permutation(tmp):

    if len(tmp) == 0:
        return [[]]
    else:
        result = []
        for i in range(len(tmp)):
            head = tmp[i]
            tail = tmp[0:i] + tmp[i+1:]
            for r in permutation(tail):
                result.append([head] + r)
        return result

def solve(a_e):

    result = 130 * 5
    for r in permutation(a_e):
        if debug:
            log("r=%s" % r)
        total = 0
        for e in r[:4]:
            tmp = e + total
            m = tmp % 10
            if m == 0:
                total = tmp
            else:
                total = tmp + (10 - m)
            if debug:
                log("e=%d, tmp=%d, total=%s" % (e, tmp, total))
        total = total + r[4]
        if debug:
            log("total=%s" % total)

        if total < result:
            if debug:
                log("r=%s" % r)
            result = total
 
    return result

def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Submission status: Accepted

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

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

l10=[int(i) for i in x if i % 10==0]
res=x
for n in l10:
    res.remove(n)

if not len(l10)==5:
    min_d=9
    for i in res:
        if int(str(i)[-1])<=min_d:
            min_d=int(str(i)[-1])
            min_num=i
    
    re2=res
    
    re2.remove(min_num)
    
    s=0
    for si in re2:
        if len(str(si))==2:
            s+=int(str(si)[0])*10+10
        elif len(str(si))==1:
            s+=10
        else:
            s+=int(str(si)[:-1])*10+10 
    print(sum(l10)+min_num+s)
else:
    print(sum(l10))

Submission status: Accepted

Solution code:
import math
a = []
k = 0
for i in range(5):
    tmp = int(input())
    a.append([tmp,(tmp-1)%10])
a.sort(reverse=True, key=lambda x:x[1])
for i in range(4):
    k += (math.ceil(a[i][0]/10))*10
k += a[4][0]
print(k)

Submission status: Accepted

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

last = [0] * 5
last[0] = int(A[-1])
last[1] = int(B[-1])
last[2] = int(C[-1])
last[3] = int(D[-1])
last[4] = int(E[-1])

total = [0] * 5
total[0] = int(A)
total[1] = int(B)
total[2] = int(C)
total[3] = int(D)
total[4] = int(E)


compare = []
index = []
i = 0


def ceil(src, range):
    x = str(src)
    if x[-1] == "0":
        return src

    return ((int)(src / range) + 1) * range


for i in range(5):
    if last[i] == 0:
        last[i] = 9

min_number = min(last)
min_idx = last.index(min(last))


ans = 0
for j in range(5):
    ans += ceil(total[j], 10)

    if j == min_idx:
        ans -= ceil(total[j], 10)


ans = ans + total[min_idx]

print(ans)

Submission status: Accepted

Solution code:
def ceil(src, range):
    if src % 10:
        return ((int)(src / range) + 1 ) * range
    else:
        return src

def main():
    input_list = []
    rand_up_list = []
    sa = {}
    for i in range(5):
        num = int(input())
        input_list.append(num)
        rand_up_list.append(ceil(num,10))
        sa[i] = rand_up_list[i] - input_list[i]
    test = sorted(sa.items(), key=lambda x: x[1])
    sum = 0
    for i in range(5):
        if i < 4:
            sum += rand_up_list[test[i][0]]
        else:
            sum += input_list[test[i][0]]
    print(sum)
    
main()

Submission status: Accepted

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

min = 10
index = 0
for i in range(5):
  if (array[i]%10) < min and 0<(array[i]%10):
    min = array[i]%10
    index = i
    
sum = int(0)
for i in range(5):
  ans = array[i]//10
  amari = array[i]%10
  if i == index :
    sum += array[i]
  elif amari == 0:
    sum += int(ans*10)
  else:
    sum += int(ans*10 +10)
  
print(sum)

Submission status: Accepted

Solution code:
# coding: utf-8

t_net = [int(input()) for _ in range(5)]
t_next = [(t+9)//10*10 for t in t_net]
diff = [y-x for x,y in zip(t_net, t_next)]

t_tuple = list(zip(t_net, t_next, diff))
t_tuple.sort(key=lambda x:x[2])
print(sum([x[1] for x in t_tuple[:-1]])+t_tuple[-1][0])

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
dic = {"A":A,"B":B,"C":C,"D":D,"E":E}
 
arr1 = []
arr2 = []
res = 0
 
for k,v in dic.items():
    if v % 10 != 0:
        arr1.append((int(v / 10) + 1 ) * 10 - v)
    res += v
    
if len(arr1) > 0:
    fraction = sum(arr1)     
    for i in arr1:
        arr2.append(fraction - i)

    print(res + min(arr2))
else:
    print(res)

Submission status: Accepted

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

items = [a, b, c, d, e]
import itertools
import math
min_total = 1000
p = itertools.permutations(items, len(items))
for v in itertools.permutations(items, len(items)):
    total = 0
    for i, item in enumerate(v):
        if i != len(v) - 1:
            total += math.ceil(item / 10) * 10
        else:
            total += item
    min_total = min(min_total, total)
print(min_total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(A, B, C, D, E):
    a = A, B, C, D, E
    ans = sum(a)
    r = []
    for v in a:
        if v % 10 != 0:
            r.append(10 - v % 10)
    
    ans += sum(r)
    if r:
        ans -= max(r)
    return ans


def main():
    A = read_int()
    B = read_int()
    C = read_int()
    D = read_int()
    E = read_int()

    print(slv(A, B, C, D, E ))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import copy
import itertools

def cooktime(n):
  if n % 10 == 0:
    ans  = n
  else:
    ans = (n//10+1)*10  
  return ans

l = []
for i in range(5):
  l.append(int(input()))
best = 9999
all_list = list(itertools.permutations(l))
while len(all_list):
  seq = all_list.pop()
  sum = 0
  for i in range(len(seq)):
    if i==4:
      sum += seq[i]
    else:
      sum = cooktime(sum+seq[i])
  if sum < best:
    best = sum

print(best)

Submission status: Accepted

Solution code:
import math

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

b = [0] * 5
c = [0] * 5

for i in range(5):
    b[i] = math.ceil(a[i] / 10) * 10

for i in range(5):
    c[i] = sum(b) - b[i] + a[i]
print(min(c))

Submission status: Accepted

Solution code:
b=10
sum=0
for _ in range(5):
  a=int(input())
  if a%10 !=0:
      sum += (a+10-a%10)
      if b>(a%10):
          b=a%10
  else:
      sum += a
print(sum-10+b)

Submission status: Accepted

Solution code:
import numpy as np
n=5
a=[int(input()) for i in range(n)]
b=[0] * 5
for i in range(5):
    b[i]=10-a[i]%10
    if b[i]==10:
        b[i]=0
b=np.array(b)
c=list(b.argsort())
x=0
for i in range(4):
    unchi=a[c[i]]
    x=x+unchi    
    if (unchi%10)!=0:
        omake=10-unchi%10
        x=x+omake
    
x=x+a[c[4]]
print(x)