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:
from collections import Counter
from functools import reduce
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  # greatest common divisor
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  # least common multiple
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
# n = II()
# dp = [INF] * n
# h = LI()
# dp[0], dp[1] = 0, abs(h[1] - h[0])
# for i in range(2, n):
    # dp[i] = min(dp[i-1] + abs(h[i]-h[i-1]), dp[i])
    # dp[i] = min(dp[i-2] + abs(h[i]-h[i-2]), dp[i])
# P(dp[n-1])


a = IS()
b = IS()
c = IS()
d = IS()
e = IS()
ryo = [a, b, c, d, e]
ryo = sorted(ryo, key=lambda x:x[-1])[::-1]
least = '10'
for i in ryo:
    if int(least) >= int(i[-1]) and int(i[-1]) != 0:
        least = i[-1]
if least == '10':
    least = '0'
for i in range(len(ryo)):
    if ryo[i][-1] == least:
        number = ryo.pop(i)
        break
for i in range(len(ryo)):
    for j in range(0,140,10):
        if int(ryo[i]) <= j:
            ryo[i] = j
            break
print(sum(ryo) +int(number))

Submission status: Accepted

Solution code:
import sys
from itertools import permutations

a = [int(i) for i in sys.stdin]

b = [(list(map(int, str(k)))[-1], i) for i, k in enumerate(a)]

indexes = [i for i, (x, y)in enumerate(b) if x == 0]
d = 0
for i in sorted(indexes)[::-1]:
  d += a[i]
  b.pop(i)
b.sort()
c = b[::-1]

for i, k in c[:-1]:
  if i > 5:
    d += round(a[k], -1)
  else:
    d += (round(a[k], -1) + 10)
if c != []:
  d += a[c[-1][1]]
print(d)

Submission status: Accepted

Solution code:
input_list=[input() for i in range(5)]
dishes = [int(n) for n in input_list]
s = 0
for n in dishes:
    if n%10 == 0:
        s += n

dishes = [n for n in dishes if n%10 != 0]
if dishes:
    minmod = min([n%10 for n in dishes])

    for n in dishes:
        s += n + 10 - n%10

    s -= 10
    s += minmod
print(s)

Submission status: Accepted

Solution code:
from sys import stdin
import math
import itertools


def makeIntMatrix(lines):
    intMatrix = []
    for a in makeStringMatrix(lines):
        intMatrix.append([int(b) for b in a])
    return intMatrix
 
 
def makeStringMatrix(lines):
    stringMatrix = [line.split() for line in lines]
    return stringMatrix
 
 
def makeInt(line):
    return int(line.rstrip())
 
 
def makeMultiInteger(line):
    return [int(x) for x in line.rstrip().split()]


def solve():
    a = makeInt(input())
    b = makeInt(input())
    c = makeInt(input())
    d = makeInt(input())
    e = makeInt(input())
    l = [0, a, b, c, d, e]
    m = 9
    m_i = 1
    for i in range(len(l)):
        if m > l[i] % 10 and l[i] % 10 > 0:
            m = l[i] % 10
            m_i = i
    if m != 0:
        temp = l[-1]
        l[-1] = l[m_i]
        l[m_i] = temp

    #ls = sorted(l)
    #print(ls)
    lst = 0
    alst = 0
    i = 1
    # 10ずつ足されるのがベスト
    at = 0
    while(i < 6):
        if at >= l[i-1]:
            #print(at, ls[i-1])
            if i != 5:
                #print(at)
                alst += at
                #print(ls[i])
            else:
                #print(at)
                alst += at
                alst += l[i]
                return alst
            at = 0
            i += 1
            #print(alst)
        else:
            at += 10


def main():
    answer = solve()
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
T = []
for i in range(5):
    T.append(input())
tmp = []
for i in range(5):
    tmp.append(int(T[i][-1]))
T2 = []
for i in range(5):
    if tmp[i] != 0:
        T2.append(int(T[i]) + 10 - tmp[i])
    else:
        T2.append(int(T[i]))
ans = []
for i in range(5):
    if tmp[i] != 0:
        ans.append(sum(T2) - 10 + tmp[i])
    else:
        ans.append(sum(T2))
    
    
    
    

print(min(ans))

Submission status: Accepted

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

min_reminder = 10
min_menu = 5
for i in range(5):
    reminder = menu[i]%10
    if reminder < min_reminder and reminder != 0:
        min_reminder = reminder
        min_menu = i
 
total = 0
for i in range(5):
    if min_menu == i or menu[i]%10 == 0:
        total += menu[i]
    else:
        total += menu[i]+10-menu[i]%10
        
print(total)

Submission status: Accepted

Solution code:
a=[]
for i in range(5):
    a.append(int(input()))
ans=0
min=10
minn=0
for i in range(5):
    if (a[i]%10<=min and a[i]%10!=0):
        min=a[i]%10
        minn=i
for i in range(5):
    if a[i]%10!=0:
        b=(a[i]//10)
        ans=ans+b*10+10
    elif a[i]==0:
        ans+=10
    else:
        ans=ans+a[i]
if min!=10:
    print(ans-(10-a[minn]%10))
else:
    print(ans)

Submission status: Accepted

Solution code:
cnt = 0
min = 10
li =[]

for i in range(5):
	a = int(input())
	li.append(a)
	if a % 10 == 0:
		cnt += a
	else:
		cnt += a + 10 - a % 10
		if a % 10 < min:
			min = a % 10

cnt = cnt + min - 10

print(cnt)

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]
last=9
for i in range(5):
    if l[i]%10!=0:
        last=min(last,l[i]%10)
        
g=0
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(l))
else:
    for i in range(5):
        if l[i]%10==0:
            g+=l[i]
        else:
            g+=l[i]+10-l[i]%10
    print(g-10+last)

Submission status: Accepted

Solution code:
def ceil(v):
	if v % 10 == 0:
		return v
	else:
		return (v // 10+1) *10

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

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

minMod = 9
last = times[0]
for time in times:
	if minMod > (time+9) % 10:
		minMod = (time+9) % 10
		last = time
		
times.remove(last)

for i,time in enumerate(times):
	times[i] = ceil(time)
	
times.append(last)

print(sum(times))

Submission status: Accepted

Solution code:
import sys
import os
import math
import numpy as np
# f = open("input.txt", 'r')
# sys.stdin = f

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

for i in li:
    if i%10 != 0:
        li4.append(10-i%10)
    else:
        li4.append(0)
# print(li4)
np.array(li4)
# print(np.argmax(li4))
atodetasu = li[np.argmax(li4)]
li.pop(np.argmax(li4))
lli = []
for i in li:
    if i % 10 != 0:
        i = i + (10- i % 10)
    lli.append(i)
# print(lli)
print(sum(lli) + atodetasu)

Submission status: Accepted

Solution code:
import math
a = list(range(5))
a[0] = int(input())
a[1] = int(input())
a[2] = int(input())
a[3] = int(input())
a[4] = int(input())
b = list(range(5))
c = list(range(5))
d = 0
s = 9
e = 0
total = 0
v = 0
for i in range(5):
    if((a[i]%10)==0):
        b[d] = a[i]
        d += 1
        v += 1
    else:
        if((a[i]%10)<s):
            s = a[i]%10
for i in range(5):
    if((a[i]%10)!=0):
        e = a[i]/10
        e = math.ceil(e)
        e = e*10
        b[d] = e
        d += 1
for i in range(5):
    total += b[i]
if(v != 5):
    total -= 10
    total += s
print(total)

Submission status: Accepted

Solution code:
x = [int(input()) for i in range(5)]
y = []
for i in range(5):
    tmp = x[i]%10
    if(tmp!=0):
        y.append(tmp)
if (y==[]):
    y = [0]
md = min(y)
print(sum(x[i]//10 for i in range(5))*10 + (len(y)-1)*10+md)

Submission status: Accepted

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

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

n = 10
x = []

for row in list:
    x.append((row + (n - row % n) % n) - row)

x.sort()

print(sum(x[:4]) + a + b + c + d + e)

Submission status: Accepted

Solution code:
import numpy as np
l = np.zeros(5)
t = np.zeros(5)
k = True
for i in range(5):
    l[i] = int(input())
    t[i] = l[i] - (l[i]//10)*10
    if t[i] != 0 :
        k = False
t.sort()
for i in range(5):
    if t[i] != 0:
        s = t[i]
        break
l = np.ceil(l/10)*10
if k :
    ans = int(np.sum(l))
else :
    ans = int(np.sum(l)+s)-10
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
dct = {}
d = {}
d2 = {}
ll = [0,1,2,3,4]

for i in range(5):
    inp = int(input())
    if inp % 10 != 0:
        d[i] = inp % 10
        d2[i] = inp
        dct[i] = int(inp/10)*10+10
    else:
        dct[i] = inp

if len(d) == 0:
    ans = 0
else:
    last = sorted(d.items(), key=lambda x: x[1])[0][0]
    ll.remove(last)
    ans = d2[last]

for i in ll:
    ans += dct[i]

print(ans)

Submission status: Accepted

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

D_mod_max = D[0]%10
D_remove = D[0]

for i in range(1,5):
  if D_mod_max==0:
    D_remove = D[i]
    D_mod_max = D[i]%10
    
  elif (D[i]%10 != 0) & (D[i]%10 < D_mod_max):
    D_remove = D[i]
    D_mod_max = D[i]%10
    
D.remove(D_remove)

sum=0
for i in range(len(D)):
  if D[i]%10 !=0:
    sum=sum+D[i]+(10-D[i]%10)
  else:
    sum=sum+D[i]

sum=sum+D_remove

print(sum)

Submission status: Accepted

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

list = []
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))
list.append(int(input()))

zflist = []
zflist.append(str(list[0]).zfill(3))
zflist.append(str(list[1]).zfill(3))
zflist.append(str(list[2]).zfill(3))
zflist.append(str(list[3]).zfill(3))
zflist.append(str(list[4]).zfill(3))

# x[-1] = 1桁目
temp = sorted(zflist, key=lambda x: x[-1])
sortedlist = []
sortedlist.append(int(temp[0]))
sortedlist.append(int(temp[1]))
sortedlist.append(int(temp[2]))
sortedlist.append(int(temp[3]))
sortedlist.append(int(temp[4]))

last = 0
for i in sortedlist:
    if str(i).zfill(3)[-1] != '0':
        # print(i)
        last = i
        break
    last = i

sortedlist.remove(last)


# print(list)
# print(sortedlist)
# print(last)

# 10区切りにする
tenlist = []
tenlist.append(math.ceil(int(sortedlist[0])/10)*10)
tenlist.append(math.ceil(int(sortedlist[1])/10)*10)
tenlist.append(math.ceil(int(sortedlist[2])/10)*10)
tenlist.append(math.ceil(int(sortedlist[3])/10)*10)
# print(tenlist)

print(sum(tenlist) + last)

Submission status: Accepted

Solution code:
e,*a=sorted(eval('int(input()),'*5),key=lambda x:~-x%10);print(e-sum(-i//10*10for i in a))

Submission status: Accepted

Solution code:
ls = []
for i in range(5):
    ls.append(int(input()))
def roundup(n):
    if n % 10 <= 5:
        return round(n+5,-1)
    else:
        return round(n,-1)
import itertools
sum = []
for p in list(itertools.permutations(ls)):
    av = 0
    cnt = 0 

    for j in p:
        av += j
        cnt += 1

        if  cnt != 5 and av % 10 != 0:
            av = roundup(av)

    sum.append(av)
print(min(sum))

Submission status: Accepted

Solution code:
from decimal import Decimal, ROUND_UP
tmp = []
time = 0
for i in range(0,5):
    w = 0
    num = int(input())
    while True:
      if float.is_integer((num + w)/10):
        break
      w += 1
    tmp.append({"num":num, "weight":w})
    
tmp = sorted(tmp, key=lambda x:x['weight'])
for i in range(0,5):
    time += tmp[i]['num']
    if i < 4:
    	time = Decimal(time/10).quantize(Decimal('0'), rounding=ROUND_UP) * 10

print(time)

Submission status: Accepted

Solution code:
import math
dish = []
mini = 0
for i in range(5):
    d = input()
    dish.append(d)
for j in dish:
    if j[-1] != '0':
        mini = j
if mini == 0:
    mini = dish[0]
for k in dish:
    if (k[-1] <= mini[-1]) and k[-1] != '0':
        mini = k
for i in range(5):
    if dish[i] == mini:
        dish.pop(i)
        break
time = 0
for l in range(4):
    dish[l] = math.ceil((int(dish[l]) / 10)) * 10
    time += int(dish[l])
time += int(mini)
print(time)

Submission status: Accepted

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

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

all = 0

all += (a // 10) * 10
if (a % 10) != 0:
    all += 10

all += (b // 10) * 10
if (b % 10) != 0:
    all += 10

all += (c // 10) * 10
if (c % 10) != 0:
    all += 10

all += (d // 10) * 10
if (d % 10) != 0:
    all += 10

all += (e // 10) * 10
if (e % 10) != 0:
    all += 10

l = [(a % 10), (b % 10), (c % 10), (d % 10), (e % 10)]
l = [x for x in l if x != 0]

#print(l)
if len(l) != 0:
    mi = min(l)
    if mi != 0:
        all -= (10 - mi)

print(all)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
times = [A,B,C,D,E]
dif = [(10-(i%10))%10 for i in times]
print(sum(times)+sum(dif)-max(dif))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = 0
nums =[a, b, c, d, e]
tmp = [i % 10 for i in nums]
if a % 10 == b % 10 == c % 10 == d % 10 == e % 10 == 0:
    print(a + b + c + d + e)
else:
    mm = [10 - i % 10 for i in nums]
    mm = [x for x in mm if x != 10]
    for i in range(5):
        if nums[i] % 10 == 0:
            ans += nums[i]
        else:
            ans += nums[i] + (10 - nums[i] % 10)
    print(ans - max(mm))

Submission status: Accepted

Solution code:
#下1桁が小さい(しかし0でない)物を最後に残す
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
S=a+b+c+d+e
A=a%10
B=b%10
C=c%10
D=d%10
E=e%10
ListN=[]
if A!=0:
  ListN.append(A)
if B!=0:
  ListN.append(B)
if C!=0:
  ListN.append(C)
if D!=0:
  ListN.append(D)
if E!=0:
  ListN.append(E)

if len(ListN)==0:
  print(S)
else:
  Listn=[]
  ListN.sort()
  for i in range(1,len(ListN),1):
    q=10-int(ListN[i])
    S+=q
  print(S)

Submission status: Accepted

Solution code:
def calc_mod(n):
  calc = (10 - n % 10)
  if calc == 10:
    return 0
  else:
    return calc

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

sum_time = sum(t)
mod_t = list(map(calc_mod, t))

print(sum(t)+sum(mod_t)-max(mod_t))

Submission status: Accepted

Solution code:
l = [int(input()) for i in range(5)]
a = []
b = []
c = []
total = 0
for i in l:
    if i % 10 == 0:
        a.append(i)
    else:
        b.append(i)
minNum = 10
ans = 0
for i in b:
    if i % 10 < minNum:
        minNum = i % 10
        ans = i
if b:
    c.append(ans)
    b.remove(ans)
if a:
    for i in a:
        total += i
if b:
    for i in b:
            total += i + (10 - i % 10)
if c:
    total += c[0]
print(total)

Submission status: Accepted

Solution code:
import sys
from operator import itemgetter
input = sys.stdin.readline
a=[None]*5
b=[None]*5
ab=[]
for i in range(5):
    a[i] = int(input())

for i in range(5):
    for h in range(14):
        h*=10
        abss=h-a[i]
        if (h>=a[i])and(0<=abss<=9):
            b[i]=h-a[i]
for i,j in zip(a,b):
    ab.append([i,j])
ab.sort(key=itemgetter(1))
s=0
for i in range(4):
    s+=sum(ab[i])
print(s+ab[-1][0])

Submission status: Accepted

Solution code:
import math

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

br = 0
last = 0
for r in range(1, 10):
    for i in range(5):
        if((arr[i] % 10) == r):
            last = i
            br = 1
            break
        pass
    if(br == 1):
        break
    pass

time = 0
for i in range(5):
    time += math.ceil(arr[i]/10) * 10

time += arr[last] - math.ceil(arr[last]/10) * 10

print(time)

Submission status: Accepted

Solution code:
def main():
  inp = []
  for i in range(5):
    x = int(input())
    if x % 10 == 0:
      inp.append([x, 0])
    else:
      inp.append([x, 10 - (x % 10)])
  inp = sorted(inp, key=lambda x: x[1]) 
  # print(inp)

  result = 0
  for i, n in enumerate(inp):
    # print(i, n[0], n[1], result)
    if (i+1) == len(inp):
      result += n[0]
      continue
    
    result += n[0] + n[1]

  print(result)
    
    
    
    
main()

Submission status: Accepted

Solution code:
# 1の位が一番小さいものを最後に頼む（0を除く）

A_E = [input() for _ in range(5)]

# 1の位だけ抜き出して整数に
unit_place_lst = [int(x[-1]) for x in A_E]
min_except0 = 10
min_index = 0
for i, n in enumerate(unit_place_lst):
    if 0 < n < min_except0:
        min_except0 = n
        min_index = i

ans = 0
for i, x in enumerate(A_E):
    if i == min_index:
        ans += int(x)
    elif (int(x) % 10) == 0:
        ans += int(x)
    else:
        ans += int(x) - (int(x) % 10) + 10

print(ans)

Submission status: Accepted

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

pos = [A, B, C, D, E]
wait_time = [10 - x % 10 if x % 10 != 0 else 0 for x in pos]
wait_time.sort()
print(sum(pos) + sum(wait_time[0:4]))

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
count = 0
min_i = 9
min_aa = 0
#しも一桁が最小のものを調べる
for i in a:
    ama = i % 10
    if (ama <= min_i) & (ama != 0):
        min_i = ama
        min_aa = i
#print('min',min_i)
aaa = 0
for i in a:
    #print(i)
    #print(i,min_aa)
    if ((i == min_aa)&(aaa == 0)):
        #print('tasuuu',i)
        count += i
        aaa += 1
    elif (i % 10 == 0):
        #print('tasui',i)
        count += i
    else:
        count += (i + (10 - i % 10))
        #print('tasu',(i + (10 - i % 10)))
print(count)

Submission status: Accepted

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

total = 100000
for i1 in range(5):
    for i2 in range(5):
        if i1 == i2: continue
        for i3 in range(5):
            if i1 == i3 or i2 == i3: continue
            for i4 in range(5):
                if i1 == i4 or i2 == i4 or i3 == i4: continue
                for i5 in range(5):
                    if i1 == i5 or i2 == i5 or i3 == i5 or i4 == i5: continue
                    temp = math.ceil(a[i1]/10)*10
                    temp += math.ceil(a[i2]/10)*10
                    temp += math.ceil(a[i3]/10)*10
                    temp += math.ceil(a[i4]/10)*10
                    temp += a[i5]
                    if total > temp:
                        total = temp

print(total)

Submission status: Accepted

Solution code:
import itertools

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

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

def calc_time(cand):
  tm = 0
  for i in range(len(cand)):
    tm += cand[i]
    if i < 4:
      if tm % 10 != 0:
        tm += 10 - (tm % 10)
  return(tm)

res = 100000
for cand in itertools.permutations(X):
  tm = calc_time(cand)
  if tm < res:
    res = tm

print(res)

Submission status: Accepted

Solution code:
import math
li =[int(input()) for i in range(5)]
min_t=999
time=0
sum_t=0
for i in range(5):
    sum_t += math.ceil(li[i]*0.1)*10
for i in range(5):
    time = sum_t - (math.ceil(li[i]*0.1)*10-li[i])
    if time<min_t:
        min_t=time
print(min_t)

Submission status: Accepted

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

for _ in S:
  if(_%10==0):
    mod.append(10)
  else:
    mod.append((_)%10)

sum=0    

for _ in range(len(S)):
  if _ == mod.index(min(mod)):
	# mod10のあまりが一番大きいやつを最後に足す(のでそのまま)
    sum += S[_]
  else:
    #mod10のあまりがなかったらそのまま足す
    if mod[_]==10:
      sum += S[_]
    #余りがあるなら
    else:
      sum += (S[_]//10+1)*10
      
print(sum)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
import numpy as np
num=[a,b,c,d,e]
resi=[i%10 if i%10 != 0 else 10 for i in num ]
x=np.argsort(resi)
minnum=num[x[0]]
del(num[x[0]])
sumnum=sum([((i//10)+1)*10 if i%10 !=0 else i for i in num])
res=sumnum+minnum
print(res)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
aa = a % 10
bb = b % 10
cc = c % 10
dd = d % 10
ee = e % 10
Ra =0
Rb =0
Rc =0
Rd =0
Re =0

if aa == 0:
    Ra = a//10
    aa = 10
else: Ra = (a //10) + 1

if bb == 0:
    Rb = b//10
    bb = 10
else: Rb = (b //10) + 1

if cc == 0:
    Rc = c//10
    cc = 10
else: Rc = (c //10) + 1

if dd  == 0:
    Rd = d//10
    dd = 10
else: Rd = (d //10) + 1

if ee == 0:
    Re = e//10
    ee = 10
else: Re = (e //10) + 1

xx = min(aa,bb,cc,dd,ee)

print(xx + (Ra +Rb + Rc +Rd + Re -1)*10)

Submission status: Accepted

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

import re
a = []
b = []
for i in range(5):
    x = int(input())
    a.append(x)
    x = x%10
    b.append(x)

count = 0
min = 123
k = 0
for i in range(5):
    if(b[i] != 0 and min > b[i]):
        min = b[i]
        k = i

for i in range(5):
    if(i != k and b[i] != 0):
        count += a[i] + 10 - b[i]
    elif(i == k or b[i] == 0):
        count += a[i]
print(count)

Submission status: Accepted

Solution code:
import sys
import itertools

input = sys.stdin.readline

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

combi_list = list(itertools.permutations(consume_times))

ans = 650
for comb in combi_list:
    time = 0
    res = 0
    for x in comb:
        time += x
        if time % 10 != 0:
            res = (10 - x%10)
            time += res
    time -= res
    if time < ans:
        ans = time

print(ans)

Submission status: Accepted

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


a_1=(int(str(a)[-1]))
b_1=(int(str(b)[-1]))
c_1=(int(str(c)[-1]))
d_1=(int(str(d)[-1]))
e_1=(int(str(e)[-1]))

if a_1==0:
    a_1=10
if b_1==0:
    b_1=10
if c_1==0:
    c_1=10
if d_1==0:
    d_1=10
if e_1==0:
    e_1=10

a_2=10-a_1
b_2=10-b_1
c_2=10-c_1
d_2=10-d_1
e_2=10-e_1

A=a+a_2
B=b+b_2
C=c+c_2
D=d+d_2
E=e+e_2
print(A+B+C+D+E-10+min(a_1,b_1,c_1,d_1,e_1))

Submission status: Accepted

Solution code:
import math
li=[]
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a2 = math.ceil(a/10)*10
b2 = math.ceil(b/10)*10
c2 = math.ceil(c/10)*10
d2 = math.ceil(d/10)*10
e2 = math.ceil(e/10)*10
s = a2+b2+c2+d2+e2
a = str(a)
b = str(b)
c = str(c)
d = str(d)
e = str(e)
li.append(int(a[-1]))
li.append(int(b[-1]))
li.append(int(c[-1]))
li.append(int(d[-1]))
li.append(int(e[-1]))
li.sort()
i=0
ans=0
while ans==0 and i!=5:
  ans=li[i]
  i+=1
if ans != 0:
  ans = 10 - ans
print(s-ans)

Submission status: Accepted

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

for i in range(5):
  ra.append(a[i]%10)

tot=0
for i in range(5):
  if ra[i]==0:
    tot+=a[i]

  else:
    tot+=a[i]+10-ra[i]
    

ra.sort()
for i in range(5):
  if ra[i]==0:
    continue
  else:
    tot-=10-ra[i]
    break
print(tot)

Submission status: Accepted

Solution code:
n = [int(input()) for _ in range(5)]
nplus = [[0,10-n[i] % 10][n[i] % 10 != 0] for i in range(5)]
nm = max(nplus)
ans, mc = 0, 0
for i in range(5):
    if nplus[i] != nm:
        ans += nplus[i] + n[i]
    else:
        mc += 1

while mc:
    for i in range(5):
        if nplus[i] == nm:
            if mc != 1:
                ans += nplus[i] + n[i]
            else:
                ans += n[i]
            mc -= 1
print(ans)

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a_num = list(map(int, str(a)))
b_num = list(map(int, str(b)))
c_num = list(map(int, str(c)))
d_num = list(map(int, str(d)))
e_num = list(map(int, str(e)))
x = a
x_num = list(map(int, str(x)))
if b_num[-1] != 0 and b_num[-1] < x_num[-1]:
    x = b
x_num = list(map(int, str(x)))
if c_num[-1] != 0 and c_num[-1] < x_num[-1]:
    x = c
x_num = list(map(int, str(x)))
if d_num[-1] != 0 and d_num[-1] < x_num[-1]:
    x = d
x_num = list(map(int, str(x)))
if e_num[-1] != 0 and e_num[-1] < x_num[-1]:
    x = e
x_num = list(map(int, str(x)))
A = math.ceil(a / 10) * 10
B = math.ceil(b / 10) * 10
C = math.ceil(c / 10) * 10
D = math.ceil(d / 10) * 10
E = math.ceil(e / 10) * 10
X = math.ceil(x / 10) * 10
print(A + B + C + D + E - (X - x))

Submission status: Accepted

Solution code:
array = []                                         
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             
raw = raw_input()                                  
array.append(int(raw))                             

total = 0                                          
last = 10                                          
for i in range(5):                                 
    n = array[i]                                   
    t = n / 10                                     
    total = total + t * 10                         
    l = n % 10
    if l!= 0:                                      
        total = total + 10                         
    if l != 0 and l < last:
        last = l                                   
total = total + last                               
print total - 10

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

res = 0
li = []
dic = {}
for i in range(5):
    li.append(int(input()))
for i in range(5):
    if li[i] % 10 != 0 and li[i] % 10 not in dic.values():
        dic[i] = li[i] % 10
if len(dic) == 0:
    res = sum(li)
else:
    m = min(dic.values())
    for j in range(5):
        if li[j] % 10 == 0:
            res += li[j]
        else:
            if li[j] % 10 == m and j in dic.keys():
                res += li[j]
            else:
                res += (li[j] // 10 + 1) * 10
print(res)

Submission status: Accepted

Solution code:
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ],default=0)
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(df == 0):
        print(sum)
else:
        print(sum-df)

Submission status: Accepted

Solution code:
def hoge(m):
    if m % 10 == 0:
        return 0
    else:
        return (m//10+1)*10-m

P = [int(input()) for i in range(5)]
# 次の注文までの時間を計算する
P_tmp = [hoge(p) for p in P]
m = max(P_tmp)
m_idx = P_tmp.index(m)
m = P.pop(m_idx)

minites = 0

for p in P:
    minites += p
    minites += hoge(minites)
minites += m
print(minites)

Submission status: Accepted

Solution code:
import sys

dish_list = [input() for i in range(5)]
ans = 0

for i in range(len(dish_list)):
    if int(dish_list[i][-1]) == 0:
        dish_list.insert(0, dish_list[i])
        del dish_list[i+1]
        continue
    for j in range(len(dish_list) - 1):
        if int(dish_list[j][-1]) < int(dish_list[j+1][-1]):
            dish_list[j], dish_list[j+1] = dish_list[j+1], dish_list[j]

#print(dish_list)

for i in range(len(dish_list)):
    tmp = int(dish_list[i])
    if i == len(dish_list) - 1 or tmp % 10 == 0:
        ans += tmp
    else:
        ans += tmp
        ans += 10 - tmp % 10

print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [tuple(map(int, l.split())) for l in sys.stdin]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    a = sorted([I() for _ in range(5)], key=lambda x: -(x%10 or 10))
    r = 0
    for c in a[:-1]:
        if c % 10 == 0:
            r += c
        else:
            r += (c//10+1) * 10
    r += a[-1]

    return r

print(main())

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(5)]
b=[(a[i]-1)//10*10 for i in range(5)]
c=[a[i]%10 for i in range(5)]
for i in range(5):
	if a[i]%10==0:
		c[i]=10
d=min(c)
print(d+40+sum(b))

Submission status: Accepted

Solution code:
import math

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

min = nyan[0]
num = 0
for i in range(5):
  if (min%10) > (nyan[i]%10) and (nyan[i]%10) != 0 or (min %10) == 0:
    min = nyan[i]
    num = i

for i in range(5):
  if num != i:
    nyan[i] = math.ceil(nyan[i]/10)*10
    sum += nyan[i]
sum += nyan[num]
print(sum)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    a = sorted([int(input()) for _ in range(5)], key=lambda x: (10 - x % 10) % 10)
    print(sum(((x - 1) // 10 + 1) * 10 for x in a[:4]) + a[4])