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 math import ceil
from itertools import permutations
X=[]
for i in range(5):
    a=int(input())
    X.append(a)
Z=list(permutations(X))
m=10**10
for A in Z:
    num=0
    for k in range(5):
        if k==4:
          num+=A[k]
          break
        num+=int(ceil(A[k]/10))*10
    m=min(m,num)
print(m)

Submission status: Accepted

Solution code:
import math
dishes = [int(input()) for _ in range(5)]
dishes_mod = 10
for i in range(5) :
  if(dishes[i]%10 != 0) : dishes_mod = min(dishes_mod, dishes[i]%10)
print(sum(list(map(lambda x: math.ceil(x), list(map(lambda x:x/10, dishes)))))*10-10+dishes_mod)

Submission status: Accepted

Solution code:
l = [int(input()) for _ in range(5)]
ans = 10**9
for i in range(5):
    ret = 0
    for j in range(5):
        if i==j:
            continue
        else:
            if l[j]%10==0:
                ret += l[j]
            else:
                ret += l[j]+(10-l[j]%10)
    ret += l[i]
    ans = min(ret,ans)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/python3

def ceil(x):
    if x % 10 == 0:
        return x
    else:
        return x // 10 * 10 + 10


def main():
    data = [int(input()) for _ in range(5)]

    firstdigit = [i % 10 if i % 10 != 0 else 10 for i in data]
    index = firstdigit.index(min(firstdigit))

    totaltime = 0
    for i, time in enumerate(data):
        if i == index:
            totaltime += time
        else:
            totaltime += ceil(time)

    print(totaltime) 


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

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

mi = an[0]
for a in an[1:]:
    if  a%10 < mi % 10 and a%10 != 0:
        mi = a
an.remove(mi)
hoge = []
for i in an:
    temp = int(math.ceil(i/10))*10
    hoge.append(temp)
ans = sum(hoge) + mi
print(ans)

Submission status: Accepted

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

a = [A, B, C, D, E]
a.sort(key=lambda x : (x-1) % 10)

ans = a[0]
for i in a[1:]:
    t = i % 10
    if t == 0:
        ans += i
    else:
        ans += 10 - t + i

print(ans)

Submission status: Accepted

Solution code:
T = []
total = 0
min_offset = 10
for _ in range(5):
    t = int(input())
    offset = t % 10
    if offset > 0:
        t = (int(t / 10) + 1) * 10
        if offset < min_offset:
            min_offset = offset
    total += t
print(total+min_offset-10)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return int(stdin.readline())

a = li()
b = li()
c = li()
d = li()
e = li()
total = 0
delta = 0
for elem in [a, b, c, d, e]:
    mod = elem % 10
    if mod == 0:
        total += elem
    else:
        d = 10 - mod
        total += elem + d
        delta = max(delta, d)
print(total - delta)

Submission status: Accepted

Solution code:
AE = [int(input()) for _ in range(5)]
Ans = 0
mini = 10
for f in AE:
    if f%10 == 0:
        Ans += f
    elif f%10 < mini:
        Ans += f + (10-mini)
        mini = f%10
    else:
        Ans += f + (10-f%10)
        
print(Ans)

Submission status: Accepted

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

mli = [A % 10 if A % 10 != 0 else 999, B % 10 if B % 10 != 0 else 999, C % 10 if C % 10 != 0 else 999,
      D % 10 if D % 10 != 0 else 999, E % 10 if E % 10 != 0 else 999]

last=mli.index(min(mli))

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

for i in range(len(li)):
      if last==i:
            pass
      else:
            li[i]=math.ceil(float(li[i]/10))*10
print(sum(li))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
a = [0,0,0,0,0]
b = [[0,i] for i in range(5)]
for i in range(5):
    a[i] = int(input())
    b[i][0] = a[i] % 10
b.sort()
j = 0
while j < 5 and b[j][0] == 0:
    j += 1
time = 0
if j == 5:
    for i in range(5):
        time += a[i]
else:
    for i in range(5):
        if i != b[j][1]:
            if a[i] % 10 == 0:
                time += a[i]
            else:
                time += (a[i] + (10 - a[i] % 10))
    time += a[b[j][1]]
print(time)

Submission status: Accepted

Solution code:
nums = [int(input()) for i in range(5)]
ans = 0
min_n = 10
idx = 0
for i in range(5):
    if nums[i] % 10  and min_n > abs(nums[i]%10):
        min_n = abs(nums[i]%10)
        idx = i
for i in range(5):
    if i == idx:
        ans += nums[i]
    else:
        if nums[i] % 10:
            ans += nums[i] + abs(10-nums[i]%10)
        else:
            ans += nums[i]
print(ans)

Submission status: Accepted

Solution code:
a = []
for i in range(5):
    a.append(int(input()))
ans = 0
mm = 10
for i in range(5):
    m = a[i] % 10
    if m > 0:
        mm = min(mm, m)
    for j in range(1, 14):
        if a[i] <= 10 * j:
            ans += 10 * j
            break

ans -= 10 - mm
print(ans)

Submission status: Accepted

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

def time(x):
    if x%10 == 0:
        return x
    else:
        return x+(10-x%10)
ans = []
ans.append(time(a)+time(b)+time(c)+time(d)+e)
ans.append(time(a)+time(b)+time(c)+time(e)+d)
ans.append(time(a)+time(b)+time(e)+time(d)+c)
ans.append(time(a)+time(e)+time(c)+time(d)+b)
ans.append(time(e)+time(b)+time(c)+time(d)+a)
print(min(ans))

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return

#B
def B():
    a = IR(5)
    b = a[0]
    ans = 0
    for a_ in a:
        if a_ % 10 != 0:
            if b % 10> a_ % 10:
                b = a_
    flg = 0
    for a_ in a:
        if a_ != b or flg:
            ans += math.ceil(a_ / 10) * 10
        else:
            ans += b
            flg = 1
    print(ans)
            
    
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
from itertools import permutations
from itertools import combinations


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

ans=float('inf')

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

per = list(permutations(aa))

for i in range(len(per)):
    p = per[i]
    time = 0
    for j in range(5):
        if(time % 10 != 0):
            time = time+(10-(time%10))
        time += p[j]
    if(time < ans):ans = time

print(ans)

Submission status: Accepted

Solution code:
ans = 0
b = 10
for _ in range(5):
    a = int(input())
    ans += (a + 9) // 10 * 10
    b = min((a - 1) % 10 + 1, b)
print(ans - 10 + b)

Submission status: Accepted

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

# ans = max(a%10, b%10, c%10, d%10, e%10) + (a+(10-a%10)) + (b+(10-b%10))+(c+(10-c%10))+(d+(10-d%10))+(e+(10-e%10)) -10

min_amari = 10
lis = [a,b,c,d,e]
ans = -10
for e in lis:
    ama = e % 10
    if ama == 0:
        ans += e
    else:
        ans += e + (10-e%10)
        if min_amari > ama:
            min_amari = ama
ans += min_amari 

print(ans)

Submission status: Accepted

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

A=10
for i in range(5):
    if L[i]%10==0:
        pass
    else:
        if L[i]%10<A:
            A=L[i]%10
if A==10:
    print(sum(L))
else:
    ans=0
    for i in range(5):
        X=L[i]+9
        X=int(X/10)
        X*=10
        ans+=X
    ans-=10
    ans+=A
    print(ans)

Submission status: Accepted

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

cnt = 0
l = [10]
for m in menu:
  cnt += m
  mod = cnt % 10
  if mod != 0:
    cnt += 10 - mod
    l.append(mod)

cnt -= 10 - min(l)
print(cnt)

Submission status: Accepted

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

ans = float('inf')

def calc(i):
    ret = i[0]
    for i in i[1:]:
        if ret % 10 != 0:
            ret += (10 - ret % 10) + i
        else:
            ret += i
    return ret

for i in permutations(a, 5):
    ans = min(ans, calc(i))

print(ans)

Submission status: Accepted

Solution code:
import math

ts = [int(input()), int(input()), int(input()), int(input()), int(input())]

ans = float('inf')
for i in range(5):
    time = 0
    for j in range(4):
        t = ts[(i + j) % 5]
        time += math.ceil(t / 10) * 10
    time += ts[(i + 4) % 5]
    ans = min(time, ans)
print(ans)

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]
L=[]
f=0
ct=0
for i in range(5):
  if l[i]%10!=0:
    f+=1
    L.append(l[i]%10)
    ct+=(l[i]//10)*10+10
  else:
    ct+=(l[i]//10)*10
if f==0:
  print(ct)
else:
  print(ct-10+min(L))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc123/tasks/abc123_b

import itertools
import collections
import bisect

def main():
    # big value
    INF = int(1e15)
    last = INF
    menus = []
    for _ in range(5):
        m = int(input())
        if last == INF:
            last = m
        else:
            if m % 10 != 0:
                m_d = m % 10
                l_d = last % 10
                if m_d < l_d:
                    last = m
        menus.append(m)

    ans = 0
    last_done = False
    for m in menus:
        if m == last and not last_done:
            ans += m
            last_done = True
        else:
            if m % 10 == 0:
                ans += m
            else:
                ans += m + (10 - m % 10)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

# n行の数をリストへ
t = [int(input()) for i in range(5)] 
answer = 0
a=10
for i in range(5):
    a = min(a,(t[i]-1)%10+1)
#    print(a)
    answer += t[i] +10 -(t[i]%10)
    if t[i] % 10 == 0:
        answer -= 10

answer = answer -10 + a
print(answer)

Submission status: Accepted

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



#%%
ans = 0
for i in alist:
    ans += ((i-1) // 10 + 1) *10
    # print(ans)

ans_b = 11
for i in alist:
    if i % 10 == 0:
        ans_b = min(ans_b, 10)
    else:
        ans_b = min(ans_b, i%10)

print(ans - (10 - ans_b))
#%%

Submission status: Accepted

Solution code:
data = [int(input()) for i in range(5)]
l = [10]
def f(x):
    if x%10 == 0:
        return x
    else:
        l.append(x%10)
        return (x//10+1)*10

print(sum([f(x) for x in data])-(10-min(l)))

Submission status: Accepted

Solution code:
import itertools
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
seq = [A,B,C,D,E]
L = list(itertools.permutations(seq))
ans = float('inf')
for i in range(len(L)):
  sub = 0
  for j in range(4):
    if L[i][j]%10 != 0:
      sub += L[i][j]-(L[i][j]%10)+10
    else:
      sub += L[i][j]
  sub += L[i][4]
  if sub <= ans:
    ans = sub
print(ans)

Submission status: Accepted

Solution code:
list=[]

for i in range(5):
    x=int(input())
    list.append([(x-1)%10, x])

list=sorted(list)
#print(list)

time=0

for r in range(len(list)):
    if r==0:
        time+=list[0][1]
    else:
        x=list[r][1]
        if x%10==0:
            time+= x
        else:
            time+= (((x-x%10)/10)+1)*10

print(int(time))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

a = ni()
b = ni()
c = ni()
d = ni()
e = ni()

f = min((a-1)%10,(b-1)%10,(c-1)%10,(d-1)%10,(e-1)%10)

ans = (a+9)//10+(b+9)//10+(c+9)//10+(d+9)//10+(e+9)//10

print(ans*10+f-9)

Submission status: Accepted

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

Qs = []
ans = 0
for A in ABCDEs:
    ans += (A+9)//10*10
    if A%10:
        Qs.append(A%10)

if Qs:
    print(ans-(10-min(Qs)))
else:
    print(ans)

Submission status: Accepted

Solution code:
A = list(int(input()) for _ in range(5))
B = [0]
for i in range(5):
    if A[i] % 10 != 0:
        
        B.append(10 - A[i] % 10)
B.remove(max(B))
print(sum(A) + sum(B))

Submission status: Accepted

Solution code:
s = 0
diff = 0
for i in range(5):
    a = int(input())
    if a%10 == 0:
        s += a
    else:
        s += (a//10+1)*10
        diff = max(diff, (a//10+1)*10 - a)
print(s-diff)

Submission status: Accepted

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

menu = [A,B,C,D,E]
menu.sort()
count  = 0
for x in menu:
    if x % 10 == 0:
        count += x
    else:
        count += 10 + (x//10)*10

cache = 10
for x in menu:
    if x%10 == 0:
        continue
    if cache > x%10:
        cache = x%10
count -= (10 - cache)
print(count)

Submission status: Accepted

Solution code:
a=[int(input()) for _ in [0]*5]
b=[(1+(x-1)//10)*10 for x in a]
c=sum(b)
ans=10**3
for i in range(5):
    ans=min(ans,c-b[i]+a[i])
print(ans)

Submission status: Accepted

Solution code:
dish = [int(input()) for _ in range(5)]
dish_10 = []
dish_1 = []
for i in dish:
    if(i%10==0):
        dish_10.append(int(i/10))
        dish_1.append(10)
    else:
        dish_10.append(int(i/10)+1)
        dish_1.append(i%10)
last = dish_1.index(min(dish_1))
ans = 0
for index,i in enumerate(dish_10):
    if(index!=last):
        ans+=i*10
ans += dish[last]
print(ans)

Submission status: Accepted

Solution code:
total_time = 0
max_save = 0
for i in range(5):
    time = int(input())
    spent_time = (time // 10 + int(bool(time % 10)))* 10
    max_save = max(max_save, spent_time - time)
    total_time += spent_time
print(total_time - max_save)

Submission status: Accepted

Solution code:
import math
A = [int(input()) for _ in range(5)]
B = list(A)
Mini = 10 ** 5
for i in range(5):
    count = 0
    for j in range(5):
        if i == j : continue
        B[j] = B[j]/10
        B[j] = math.ceil(B[j]) * 10
        count += B[j]
    count += A[i]
    Mini = min(Mini,count)

print(Mini)

Submission status: Accepted

Solution code:
an = [int(input()) for i in range(5)]
an2 = [i%10 for i in an]
an3 = [10 if i ==  0 else i for i in an2]

a=an[an3.index(min(an3))]
an.remove(a)
ans = a
for i in an:
     if i%10 == 0:
          ans += i
     else:
          ans += (i//10)*10+10
print(ans)

Submission status: Accepted

Solution code:
import sys
dishes = [int(input()) for _ in range(5)]
a = [(d%10,d) for d in dishes if d%10>0]
if a==[]:
    print(sum(dishes))
    sys.exit()
min_ = min(a)

ans = min_[1]
dishes.remove(min_[1])
for d in dishes:
    if d%10==0:
        ans += d
    else:
        ans += (d//10+1)*10
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
import math

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

min1 = map(lambda x: x % 10, t)
min1 = min([10 if i == 0 else i for i in min1])

print(sum(map(lambda x: math.ceil(x) * 10, [i/10 for i in t])) - (10 - min1))

Submission status: Accepted

Solution code:
import itertools

A = [0 for i in range(5)]
for i in range(5):
    A[i] = int(input())
    
ans = 1000
for perm in itertools.permutations(A):
    this_ans = 0
    for a in perm[:-1]:
        if a % 10 == 0:
            this_ans += a
        else:
            this_ans += (a//10 + 1) * 10
    this_ans += perm[-1]
    ans = min(ans, this_ans)

print(ans)

Submission status: Accepted

Solution code:
a, b, c, d, e = [int(input()) for _ in range(5)]
nums = [a, b, c, d, e]
tmp = [num if num % 10 == 0 else 10 * (num // 10 + 1) for num in nums]
buf = [num % 10 for num in nums if num % 10 != 0]
if not buf:
    print(sum(nums))
    exit()
ans = sum(tmp) + min(buf) - 10
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8-*-
if __name__ == '__main__':
    a = []
    b = []
    idx = 0
    r = 10
    for i in range(5):
        a.append(int(input()))
        if a[-1] % 10 == 0:
            if r == 10:
                idx = i
            b.append(a[-1])
        else:
            if r > a[-1] % 10:
                r = a[-1] % 10
                idx = i
            b.append(a[-1] - a[-1] % 10 + 10)
    sum = 0
    for i in range(5):
        if i == idx:
            sum += a[i]
        else:
            sum += b[i]
    print(sum)

Submission status: Accepted

Solution code:
list = []
for i in range(5):
    a = int(input())
    list.append(a)
list1 = []
for i in range(5):
    list1.append(list[i]%10)

min = 10
min_ind = 0
for i in range(5):
    if min > list1[i] > 0:
        min = list1[i]
        min_ind = i
cnt = []
for i in range(5):
    if i != min_ind:
        for j in range(1,14):
            if list[i] <= 10 * j:
                cnt.append(10*j)
                break
    else:
        cnt.append(list[i])
print(sum(cnt))

Submission status: Accepted

Solution code:
import math

vals = []
for _ in range(5):
	vals.append( int(input()) )

amari = sorted([val % 10 for val in vals if val % 10 != 0])
rounded = [math.ceil(val/10)*10 for val in vals]


ret = sum(rounded)
if len(amari) > 0:
	ret += amari[0] - 10

print(ret)

Submission status: Accepted

Solution code:
# encoding:utf-8
import copy
import numpy as np
import random
import bisect #
import math

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

amari = 10
for i in range(5):
    if menu_time[i]%10>0:
        amari = min(menu_time[i]%10,amari)
    ans += math.ceil(menu_time[i]/10)*10

ans -= 10
ans += amari


print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
def up(i):
    if i%10 != 0:
        return (i//10+1)*10
    else:
        return i
print(min([a+up(b)+up(c)+up(d)+up(e),up(a)+b+up(c)+up(d)+up(e),up(a)+up(b)+c+up(d)+up(e),up(a)+up(b)+up(c)+d+up(e),up(a)+up(b)+up(c)+up(d)+e]))

Submission status: Accepted

Solution code:
import math

def solve():
  ABCDE = [int(input()) for i in range(5)]
  s = sum(map(lambda v: math.ceil(v * 0.1) * 10, ABCDE))
  k = 10
  for i in ABCDE:
    _i = i % 10
    if _i == 0: continue
    if k == 0: k = _i
    else: k = min(k, _i)
  s = s + k - 10
  return s

print(solve())

Submission status: Accepted

Solution code:
times = []
ones = [10]
for i in range(5):
    t = int(input())
    times.append((t + 9) // 10 * 10)
    ones.append(t % 10)
ones.sort()
print(sum(times) - 10 + min(filter(lambda x: x, ones)))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
#a, b, c = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
# b = list(map(int, input().split()))

# 空白区切り文字列
# t, d = input().split()

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

mm = 99999

kumi = list(itertools.permutations(ll))

for kk in kumi:
    sum = 0
    for s in kk:
        if sum % 10 != 0:
            sum += 10 - sum % 10
        sum += s
    mm = min(mm, sum)
print(mm)

Submission status: Accepted

Solution code:


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

ans = 0
max_tmp = 0
for i in ABCDE:
    tmp = i
    if i % 10 != 0:
        tmp = (i + 10) // 10 * 10
    ans += tmp
    max_tmp = max(max_tmp, (tmp - i))
ans -= max_tmp

print(ans)

Submission status: Accepted

Solution code:
data = [int(input()) for i in range(5)]
upped = list(map(lambda x: x if x % 10 == 0 else (x // 10 + 1) * 10, data.copy()))
wait = []
for s, t in zip(data, upped):
    wait.append(t - s)
print(sum(upped) - max(wait))

Submission status: Accepted

Solution code:
l = []

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

ans = float('inf')

def std_num(num):
  r = num % 10
  return num if r == 0 else num + (10 - r)

for i in range(5):
  total = 0

  for j in range(5):
    if i == j:
      total += l[j]
    else:
      total += std_num(l[j])

  ans = min(total,ans)

print(ans)

Submission status: Accepted

Solution code:
a = []
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))
a.append(int(input()))

a = list(reversed(sorted(a, key=lambda x: 100 if x % 10 == 0 else x % 10)))
# print(a)

ans = 0
for i in range(5):
    ans += a[i]
    if ans % 10 != 0 and i != 4:
        ans += 10 - (ans % 10)


print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[]
for i in [a,b,c,d,e]:
    l.append([(10-i%10)%10,i])

l.sort()
ans=0

for i in range(5):
    if i<=3:
        ans+=l[i][0]+l[i][1]
    else:
        ans+=l[i][1]

print(ans)

Submission status: Accepted

Solution code:
#! /usr/bin/python3
import itertools

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


answer = 10000000000
for os in itertools.permutations([a, b, c, d, e]):
    t = 0
    m = 0
    for o in os:
        if m > 0:
            t += 10 - m
        t += o
        m = t % 10
    if t < answer:
        answer = t
        a = o

print(answer)

Submission status: Accepted

Solution code:
a=[]
ans = 0
for i in range(5):
  e = int(input())
  if e%10==0:
    ans+=e
  else:
    ans+=e+10-(e%10)
    a.append(e)

a.sort(key=lambda x:x%10)
if len(a)>0:
  ans-=(10-a[0]%10)

print(ans)

Submission status: Accepted

Solution code:
a, b, c, d, e = int(input()), int(input()), int(input()), int(input()), int(
    input())
cook = [a, b, c, d, e]
A = [10 - a % 10, 10 - b % 10, 10 - c % 10, 10 - d % 10, 10 - e % 10]
for i in range(5):
    if A[i] == 10:
        A[i] = 0

print(sum(cook) + sum(A) - max(A))

Submission status: Accepted

Solution code:
D = [int(input()) for _ in range(5)]
D.sort(key=lambda x: 10 - (x - 1) % 10)
ans = 0
for i in range(4):
    while(D[i] % 10 != 0):
        D[i] += 1
    ans += D[i]
ans += D[-1]
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
import math
import numpy as np

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


times = []
for _ in range(5):
    times.append(d_in())


min_val = 10
ans = 0
for i, t in enumerate(times):
    if t % 10 > 0 and t % 10 < min_val:
        min_val = t % 10
    ans += math.ceil(t / 10) * 10

if min_val == 10:
    print(ans)
else:
    print(ans - 10 + min_val)

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]

r = list(map(lambda x:x % 10,l))
r = [x if x != 0 else 10 for x in r]

index = r.index(min(r))


ans = 0

for i in range(5):
	if i == index:
		ans += l[i]
	else:
		if l[i] % 10 == 0:
			ans += l[i]
		else:
			ans += (l[i]//10 + 1) * 10

print(ans)

Submission status: Accepted

Solution code:
import math
import sys

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

tmp=100
p=100
for i in range(5):
    if a[i]%10!=0 and a[i]%10<tmp:
        tmp=a[i]%10
        p=i


if p==100: print(sum(a))
else:
    ans=0
    for i in range(5):
        if i==p: ans+=a[p]
        else: ans+=math.ceil(a[i]/10)*10
    print(ans)

Submission status: Accepted

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

import itertools
import math

import sys

X = []
for _ in range(5):
    X.append(int(input()))

min_time = int(1e10)
for A in itertools.permutations(X, 5):
    time = 0
    for i, a in enumerate(A):
        if i == 4:
            time += a
        else:
            time += math.ceil(a / 10) * 10
        
    min_time = min(min_time, time)
    
print(min_time)

Submission status: Accepted

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

for k, i in enumerate(lst):
    if i % 10 == 0:
        index = k

rest = 9
for k, i in enumerate(lst):
    if 0 < i % 10 <= rest:
        rest = i % 10
        index = k

ans = 0
for k, i in enumerate(lst):
    if k == index:
        ans += i
    else:
        if i % 10 == 0:
            ans += i
        else:
            ans += i + (10 - (i % 10))
print(ans)

Submission status: Accepted

Solution code:
import math
menu = sorted([int(input()) for _ in range(5)])
ans = 0
rest = 10
for a in menu:
    ans += math.ceil(a/10) * 10
    rest = rest if a%10==0 else min(rest, a%10)
# print(rest)
print(ans - 10 +  rest)

Submission status: Accepted

Solution code:
import itertools
def bit(n, m):
    bit_list = list(itertools.product([i for i in range(m)], repeat=n))
    return bit_list

l = [int(input()) for _ in range(5)]
bit = bit(5,5)
bit_n = []
for i in bit:
    if len(set(i)) == 5:
        bit_n.append(i)

res = float("inf")
for i in bit_n:
    time = 0
    for j in i:
        if time == 0:
            time += l[j]
        else:
            if time % 10 != 0:
                while time % 10 != 0:
                    time += 1
                time += l[j]
            else:
                time += l[j]
    if res > time:
        res = time

print(res)

Submission status: Accepted

Solution code:
amari = 10

li = []
for i in range(5):
    a = int(input())
    if a % 10 == 0:
        li.append(a)
    else:
        li.append((a // 10 + 1) * 10)
        if a % 10 < amari:
            amari = a % 10


print(sum(li)-10+amari)

Submission status: Accepted

Solution code:
def five_dishes(A: int, B: int, C: int, D: int, E: int)->int:
    dishes = sorted([A, B, C, D, E], key=lambda x: x % 10 if x % 10 else 10)

    def offset(d: int)->int:
        return 10 - d % 10 if d % 10 else 0
    return dishes[0] + sum(d + offset(d) for d in dishes[1:])


if __name__ == "__main__":
    inputs = [int(input()) for _ in range(5)]
    A, B, C, D, E = inputs
    ans = five_dishes(A, B, C, D, E)
    print(ans)

Submission status: Accepted

Solution code:
L = sorted([int(input()) for _ in range(5)], key=lambda x: - x % 10)
t = L[0]
for l in L[1:]:
    if t % 10 != 0:
        t += (10 - t % 10)
    t += l
print(t)

Submission status: Accepted

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

import numpy as np

def get_time(i):
    return int(np.ceil(i / 10) * 10)

total1 = get_time(a) + get_time(b) + get_time(c) + get_time(d) + e
total2 = a + get_time(b) + get_time(c) + get_time(d) + get_time(e)
total3 = get_time(a) + b + get_time(c) + get_time(d) + get_time(e)
total4 = get_time(a) + get_time(b) + c + get_time(d) + get_time(e)
total5 = get_time(a) + get_time(b) + get_time(c) + d + get_time(e)
print(min([total1, total2, total3, total4, total5]))

Submission status: Accepted

Solution code:
from itertools import permutations
*T, = map(int, open(0).read().split())
ans = 10**20
for p in permutations(T):
    r = 0
    for i, t in enumerate(p):
        if i < 4:
            r += (t+9)//10*10
        else:
            r += t
    ans = min(ans, r)
print(ans)

Submission status: Accepted

Solution code:
A=[]
for i in range(5):
  A.append(input())
A.sort(key=lambda x:(int(x[-1])-1)%10)
ans=0
A=[int(x) for x in A]
for i in range(1,5):
  ans+=A[i]//10*10
  ans+=0 if A[i]%10==0 else 10
print(ans+A[0])

Submission status: Accepted

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

min=700
for dish in itertools.permutations(l, 5):
    index=1
    sum=dish[0]
    while index < len(dish):
        if sum%10==0:
            sum+=dish[index]
        else:
            sum = ((sum//10)+1)*10
            sum += dish[index]
        index+=1
    if sum < min:
        min = sum
print(min)