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, B, C, D, E = [int(input()) for _ in range(5)]

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

time_dig = [-(-food // 10) for food in menu]
time_mod_10 = [_ % 10 for _ in menu if _ % 10 != 0]
time_mod_10.append(10)

print((sum(time_dig) - 1) * 10 + min(time_mod_10))

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(5)]
t=0
mx=10
for i in l:
    if i%10!=0 and i%10<mx:
        mx=i%10
    if i%10==0:
        t+=i
    else:
        t+=int(i/10.0)*10+10


print(t-10+mx)

Submission status: Accepted

Solution code:
n = 5
l = [int(input()) for _ in range(n)]
ans = sum(l)
times = []
for i in l:
    num = i - (int(i / 10) * 10)
    times.append((10 - num) % 10)

times.sort()
for i in range(n - 1):
    ans += times[i]
print(ans)

Submission status: Accepted

Solution code:

a = []
b = []
for i in range(5):
    ai = int(input())
    a.append([ai,ai%10])
    if ai%10 == 0:
        a[i][1]=10

a.sort(key=lambda x: x[1])

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

time += a[0][0]
print(time)

Submission status: Accepted

Solution code:
dis = [int(input()) for i in range(5)]
n,c = 10,11
for i,k in enumerate(dis):
  if c>(k%10) and k%10>=1:
    c = (k%10)
    n = i
for i,k in enumerate(dis):
  if i == n:
    continue
  else:
    if k%10==0:
      continue
    else:
      dis[i]=int(k/10)*10+10
ans = 0
for i in dis:
  ans+=i
print(ans)

Submission status: Accepted

Solution code:
def kiriage(n):
    while n %10  !=0:
        n+=1
    return n

def myfinal(A):
    r= 10
    r2 = 0
    for i in range(5):
        if A[i] % 10 < r and A[i] % 10 != 0:
            r = A[i] %10
            r2= i
    return r2

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

f = myfinal(A)
ans = A[f]
for i in range(0,5):
    if i != f:
        ans += kiriage(A[i])
print(ans)

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]
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(list))
    exit()
min=100
for i in range(len(list)):
    if list[i]%10!=0 and list[i]%10<min:
        memo=list[i]
        min=list[i]%10
flag=0
for k in range(len(list)):
    if list[k]==memo and flag==0:
        flag=1
    else:
        while list[k]%10!=0:
            list[k]+=1
print(sum(list))

Submission status: Accepted

Solution code:
def ii2ss(n):
    ss = []
    for i in range(n):
        ss.append(input())
    return ss

def sp2nn(sp, sep=' '):
    return [int(s) for s in sp.split(sep)]

def ss2nn(ss):
    return [int(s) for s in list(ss)]

import math
def main(ss):
    nn = ss2nn(ss)
    total = 0
    mod = 0
    for n in nn:
        n2 = math.ceil(n/10)*10
        total += n2
        m = n % 10
        if m != 0:
            if mod == 0:
                mod = m
            elif m < mod:
                mod = m
    if mod != 0:
        total -= 10 - mod
    return total
ss = ii2ss(5)
print(main(ss))

Submission status: Accepted

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

def dfs(ordered, remain, tim):
    if len(remain) == 0:
        #print("o", ordered, tim)
        return tim

    tims = []
    for r in remain:
        o = copy.copy(ordered)
        o.append(r)
        r2 = copy.copy(remain)
        r2.remove(r)
        t3 = (10 - tim % 10)
        t4 = 0 if t3 == 10 else t3
        tim2 = tim + t4  + r
        #print("tim", tim, t4, r)
        tims.append(dfs(o, r2, tim2))
    return min(tims)

print(dfs([], A, 0))

Submission status: Accepted

Solution code:
dish = [0]*5
for i in range(5):
  dish[i] = int(input())
dish = [i for i in dish if i%10==0] + sorted([i for i in dish if i%10!=0], key=lambda x: -x%10)
sum_ = 0
for d in dish[:-1]:
  sum_ += d
  if sum_%10!=0:
    sum_ -= (sum_%10)
    sum_ += 10
print(sum_+dish[-1])

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
if a%10==0:
  A = 0
else:
  A=10-a%10
if b%10==0:
  B=0
else:
  B = 10-b%10
if c%10==0:
  C=0
else:
  C = 10-c%10
if d%10==0:
  D=0
else:
  D = 10-d%10
if e%10==0:
  E=0
else:
  E = 10-e%10
listA = [A,B,C,D,E]
listA.sort()
f = a+b+c+d+e+listA[0]+listA[1]+listA[2]+listA[3]
print(f)

Submission status: Accepted

Solution code:
import itertools
import math

dishes = list(map(int, [input() for _ in range(5)]))
p_list = list(itertools.permutations(dishes))

min_total_time = 1000000000
for p in p_list:
    next_time = 0
    for idx, dish in enumerate(p):
        if idx <= 3:
            next_time = math.ceil((next_time + dish) / 10) * 10
        else:
            next_time += dish
    min_total_time = min(min_total_time, next_time)

print(min_total_time)

Submission status: Accepted

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

alhoge = [0 if x % 10 == 0 else (10 - (x % 10)) for x in al]
# print(alhoge)
alsorted = sorted(al, key=lambda x: 0 if x % 10 == 0 else (10 - (x % 10)))
# print(alsorted)

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

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

f=[a,b,c,d,e]
f2=[]
for i in range(5):
    res=0
    for j in range(5):
      if i==j:
        res+=f[j]
      else:
        res+=int(np.ceil(f[j]/10)*10)
    f2.append(res)
print(min(f2))

Submission status: Accepted

Solution code:
m = 10**5
w = []

for i in range(0, 5):
    w.append(int(input()))

def s(c):
    
    global m
    global w
    r = 0
    for i in range(0, 5):
        r += w[c[i]]
        if r % 10 > 0 and i < 4:
            r = (r // 10 + 1) * 10
    if r < m:
        m = r

def t(c, r):
    if len(c) == 5:
        s(c)
    else:
        for i in r:
            nr = r[:]
            nr.remove(i)
            t(c + [i], nr)

t([], [0, 1, 2, 3, 4])
print(m)

Submission status: Accepted

Solution code:
ABCDE = []
ABCDEamari = []
for i in range(5):
    ABCDE.append(int(input()))
    ABCDEamari.append(ABCDE[i]%10)
answer = 0
for i in range(5):
    if ABCDEamari[i] == 0:
        answer += ABCDE[i]
    else:
        answer += (ABCDE[i]//10)*10 + 10

min = 10

for i in range(5):
    if min > ABCDEamari[i] and ABCDEamari[i] != 0:
        min = ABCDEamari[i]
    

answer -= (10-min)%10

print(answer)

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
list1 = [a, b, c, d, e]
result = 0
last = 10
for i in range(0, 5):
    tmp = math.floor(list1[i] / 10) * 10
    if last > list1[i] - tmp and list1[i]-tmp != 0:
        last = list1[i]-tmp
    result += math.ceil(list1[i]/10)*10

print("{}".format(result-(10-last)))

Submission status: Accepted

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

ans=0
for i in range(5):
  ans+=max((((menu[i]-1)//10)+1)*10,10)

tmp=[]
for i in range(5):
  s=str(menu[i])
  tmp.append(int(s[-1]))
tmp.sort()

hiku=0
for i in range(5):
  if not tmp[i]==0:
    hiku=tmp[i]
    break
    
if not hiku==0:
  ans = ans-(10-hiku)
  
print(ans)

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]
y=[]
z=[]
ans=0
for i in range(5):
    z.append(x[i]//10)
    if x[i]%10==0:
        y.append(10)
        z[0]-=1
    else:
        y.append(x[i]%10)
    
for i in range(5):
    ans+=z[i]

ans+=4
ans*=10
ans+=min(y)

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]
p=10
ix=0
for i in range(len(l)):
  x=l[i]
  q=x%10
  if q!=0 and q<p:
    p=q
    ix=i
r=l[ix]
l.remove(r)
s=0
for x in l:
  s+=x
  if x%10!=0:
    s+=10-(x%10)
print(s+r)

Submission status: Accepted

Solution code:
time = 0
a = int(input())
b= int(input())
c = int(input())
d = int(input())
e = int(input())
lis = [a,b,c,d,e]
for num in lis:
    time += num
amarilis = []
for item in lis:
    if item % 10 == 0:
        amarilis.append(0)
    else:
        amarilis.append(10 -(item % 10))


amarilis.sort()

del amarilis[4]

for nu in amarilis:
    time += nu
print(time)

Submission status: Accepted

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

Submission status: Accepted

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

import math

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

ans = math.ceil(a / 10)
ans += math.ceil(b / 10)
ans += math.ceil(c / 10)
ans += math.ceil(d / 10)
ans += math.ceil(e / 10)
ans *= 10
ans += min((a-1) % 10, (b-1) % 10, (c-1) % 10, (d-1) % 10, (e-1) % 10) - 10 + 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())
li = [A, B, C, D, E]
temp = 9
idx = -1
for i in range(len(li)):
    if 0 != li[i] % 10 and temp >= li[i] % 10:
        temp = li[i] % 10
        idx = i

result = 0
for i in range(len(li)):
    if idx == i:
        result += li[i]
    else:
        result += math.ceil(li[i] / 10) * 10
print(result)

Submission status: Accepted

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

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

    min_one = 10
    min_in = -1
    for i, val in enumerate(time_list):
        # 1桁目をミル
        un_one = val % 10
        if min_one > un_one and un_one != 0:
            min_one = un_one
            min_in = i

    res_list = []
    for i, val in enumerate(time_list):
        if i == min_in:
            res_list.append(val)
        else:
            dif = val % 10
            if dif == 0:
                res_list.append(val)
            else:
                res_list.append(val - dif + 10)
    res_sum = 0
    for v in res_list:
        res_sum += v

    print(res_sum)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
ans=0
a=[0]*5
for i in range(5):
    t=int(input())
    t2=t%10

    if t2==0:
        a[i]=t2+10
        ans=ans+t
    else:
        a[i]=t2
        ans=ans+((t//10)*10)+10
if min(a) !=10 :
    print(ans-10+min(a))
else:
    print(ans)

Submission status: Accepted

Solution code:
times = [int(input()) for _ in range(5)]
fractions = [10 - t % 10 for t in times if t % 10 != 0]
if fractions:
    fraction = max(fractions)
else:
    fraction = 0
print(sum([(t - t % 10) + ((t % 10 + 9) // 10) * 10 for t in times]) - fraction)

Submission status: Accepted

Solution code:
A = sorted( [input()[::-1] for i in range(5)] )
c = 0
while (A[0][0] == "0" and c<5):
  tmp = A.pop(0)
  A.append(tmp)
  c+=1

A = [int(a[::-1]) for a in A][::-1]

def roundUp(n):
  return n if n%10==0 else n + (10-n%10)

print(sum([roundUp(A[i]) for i in range(4)]) + A[4])

Submission status: Accepted

Solution code:
import math
nums=[]
round_nums=[]
for i in range(5):
    k=int(input())
    nums.append(k)
    round_nums.append(math.ceil(k/10.0)*10)

dist=0
for i in range(5):
    if round_nums[i]-nums[i]>dist:
        dist=round_nums[i]-nums[i]

#print(nums)
print(int(sum(round_nums)-dist))

Submission status: Accepted

Solution code:
read = input
a = [read() for i in range(5)]
a = list(map(int, a))
if all(map(lambda x: x%10 == 0, a)):
    print(sum(a))
else :
    g10 = list(filter(lambda x:x%10 > 0 , a))
    l10 = list(filter(lambda x:x%10 == 0 , a))
    m = min(g10, key=lambda x:x%10)
    g100= list(map(lambda x:x//10*10 + 10, g10))
    print(sum(g100)  +sum(l10)- m//10*10 - 10 + m)

Submission status: Accepted

Solution code:
# Strategy: smallest 1's digit at the last. Others don't matter.
time = [None] * 5
smallest = 10
smallest_i = -1 
for i in range(5):
    time[i] = int(input())
    if (time[i] - 1) % 10 < smallest:
        # order: 1,2,3...9,0
        smallest = (time[i] - 1) % 10 
        smallest_i = i
total = 0
for i, t in enumerate(time):
    if i == smallest_i:
        total += time[i]
    else:
        rem = time[i] % 10
        if rem == 0:
            total += time[i]
        else:
            total += time[i] - rem + 10
print(total)

Submission status: Accepted

Solution code:
dish, time = [], 0
for i in range(5):
    temp = int(input())
    if temp % 10 == 0:
        time += temp
    else:
        dish.append(temp)
if dish:
    left = 10 - min([x % 10 for x in dish])
    time = time + sum([x + 10 - x % 10 for x in dish]) - left
print(time)

Submission status: Accepted

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

loss = list(map(lambda x: (10 - (x % 10)) % 10, p))
last_i = loss.index(max(loss))

print(sum(p) + sum(loss) - loss[last_i])

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=[a,b,c,d,e]
sum=0
for i in range(5):
    if f[i]%10==0:
        sum+=f[i]
    else:sum+=(f[i]//10)*10+10
    f[i]=f[i]%10-1
    if f[i]==-1:f[i]=9
r=min(f)
if r==9:
    print(sum)
else:
    q=9-r
    print(sum-q)

Submission status: Accepted

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

rest = []
time = 0
for order in orders:
    if order % 10 == 0:
        time += order
    else:
        rest.append(order)

rest_mods = list(map(lambda x: x % 10, rest))

if len(rest_mods) > 0:
    min_mods_index = rest_mods.index(min(rest_mods))
    for i in range(len(rest)):
        time += rest[i]
        if i != min_mods_index:
            time += 10 - rest[i] % 10
else:
    time += sum(rest)
print(time)

Submission status: Accepted

Solution code:
def f(n):
    if n%10!=0:
        return 10-(n%10)
    else:
        return 0
A=[int(input()) for i in range(5)]
X=[10*(-((-i)//10)) for i in A]
d=max([f(i) for i in A])
print(sum(X)-d)

Submission status: Accepted

Solution code:
a=[int(input()) for _ in range(5)]
b=[]
ans=0
for i in a:
    tmp=i
    while tmp>10:
        tmp-=10
    b.append((tmp,i))
b.sort(key=lambda x:x[0])
for i in range(5):
    if i==4:
        ans+=b[4-i][1]
    else:
        ans+=b[4-i][1]+10-b[4-i][0]
print(ans)

Submission status: Accepted

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

ans = 0
x = []

for i in [a,b,c,d,e]:
  if i % 10 != 0:
    ans += (i//10)*10 + 10
    x.append(i%10)
  else:
    ans += i

if x != []:
  ans -= 10-min(x)
print(ans)

Submission status: Accepted

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

rs = [i if i != 10 else 0 for i in [10 - A%100%10, 10-B%100%10, 10-C%100%10, 10-D%100%10, 10-E%100%10]]
m = max(rs)

s = A + B + C + D + E + sum(rs) - m
print(s)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a, b, c, d, e]
dish_max = []
min_num = 10
min_index = -1
for i in range(len(dish)):
  if (dish[i]-1)%10<min_num:
    min_num = (dish[i]-1)%10
    min_index = i
  else:
    None
#print(min_index, min_num)
time = 0
for i in range(len(dish)):
  if i!=min_index:
    if dish[i]%10!=0:
      time += int(dish[i]/10)*10+10
    else:
      time += dish[i]
  else:
    time += dish[i]
print(time)

Submission status: Accepted

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

ans = 0
mini = []
for i in AE:
    if(i%10 == 0):
        ans += i
    else:
        ans += (i//10 + 1)*10
        mini.append(i%10)
if(mini != []):
    print(ans + min(mini) - 10)
else:
    print(ans)

Submission status: Accepted

Solution code:
a = [int(input()) for x in range(5)]
sum = 0
b = []
for i in range(5):
    if a[i]%10 == 0:
        sum += a[i]
    else:
        c = a[i] + (10 -a[i]%10)
        sum += c
        b.append(a[i]%10)
if b != []:
    b.sort()
    sum -= 10 - b[0]
print(sum)

Submission status: Accepted

Solution code:
L = []
for i in range(5):
    L.append(int(input()))
    
s = [0,1,2,3,4]
import itertools
ans_L = []
for i in itertools.permutations(s, 5):
    ans = 0
    for j,k in enumerate(i):
        ans += L[k]
        if ans % 10 != 0 and j != 4:
            for l in range(1,10):
                if (ans + l) % 10 == 0:
                    ans += l
                    break
    ans_L.append(ans)
print(min(ans_L))

Submission status: Accepted

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

ans = sum(x)
if len(y) != 0:
    s = 10 - min(y)
    ans -= s

print(ans)

Submission status: Accepted

Solution code:
from math import ceil
t = 0
a = [int(input()) for _ in range(5)]
m = min(map(lambda x: (x - 1) % 10 + 1, a))
for c in a:
    if (c - 1) % 10 + 1 == m:
        m = c
a.remove(m)
t += sum(map(lambda x: ceil(x / 10), a))
t *= 10
print(t + m)

Submission status: Accepted

Solution code:

N = 5
order_times = [int(input()) for i in range(N)]
last_times = [(10-(ot%10))%10 for ot in order_times]
last_time = max(last_times)
ans = sum([((ot + 9)//10)*10 for ot in order_times]) - last_time
print(ans)

Submission status: Accepted

Solution code:
A = [int(input()) for i in range(5)]
min_1 = 10
sum_v = -10

for num in A:
    dig1 = num % 10
    if dig1:
        min_1 = min(min_1, dig1)

    if dig1:
        sum_v += (num // 10) * 10 + 10
    else:
        sum_v += num

if min_1 != 10:
    print(sum_v + min_1)
else:
    print(sum_v + min_1)

Submission status: Accepted

Solution code:
def ceil10(i):
  z=int(i/10)
  z=z*10
  z=10-(i-z)
  if z==10:
    z=0
  return i+z

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

min1=(-1,9999)
for i,b in enumerate(a):
  c=int(b/10)
  c=c*10
  c=b-c
  if c==0:
    c=10
  if min1[1]>c:
    min1=(i,c)
ans=0

for i,b in enumerate(a):
  if i!=min1[0]:
    ans+=ceil10(b)
  else:
    ans+=b
print(ans)

Submission status: Accepted

Solution code:
times = []

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

times = sorted(times, key=lambda x: x%10)

ans = 0
for i, t in enumerate(times):
    if t%10==0:
        ans += t
    else:
        ans += t
        break

for j in range(i+1,5):
    ans += (times[j]//10)*10 + 10

print(ans)

Submission status: Accepted

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

best = 10**9
import itertools
for pan in itertools.permutations(an):
    s = 0
    for i in range(4):
        q,m=divmod(pan[i],10)
        if m>0:
            q += 1
        s += q*10
    s += pan[4]
    if s < best:
        best = s
print(best)

Submission status: Accepted

Solution code:
import math


def main():
    items = []

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

    maxi = 0
    for i in range(5):
        if items[i] % 10 < items[maxi] % 10 and items[i] % 10 != 0:
            maxi = i

    ret = 0
    for i in range(5):
        if i != maxi:
            if items[i] % 10 != 0:
                ret += int(math.floor(items[i] / 10) + 1) * 10
            else:
                ret += int(math.floor(items[i] / 10)) * 10
            continue
        ret += items[i]

    print(ret)


main()

Submission status: Accepted

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

b = []
for i in range(len(a)):
    k = int(a[i] / 10)
    sel = abs((k+1)*10 -a[i])
    if sel ==10:
        b.append(0)
    else:
        b.append(sel)
    
order_list= sorted(range(len(b)), key=lambda k: b[k])

count = 0
for i in range(len(order_list)):
    count += a[order_list[i]]
    remain = int(count %10)
    if remain != 0 and i != len(order_list)-1:
        count += (10- remain)

print(count)

Submission status: Accepted

Solution code:
import math

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

div = []
for t in [a,b,c,d,e]:
  div.append(math.ceil(t/10)*10)

m = []
for t in [a,b,c,d,e]:
  if 0 < (t % 10):
    m.append(t%10)

if len(m) == 0:
  print(sum(div))
else:
  print(sum(div)-(10-min(m)))

Submission status: Accepted

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

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

ryouri_amari = [x % 10 for x in ryouri]

idx = 0
min_amari = 10

for i, amari in enumerate(ryouri_amari):
    if amari == 0:
        continue
    elif amari < min_amari:
        min_amari = amari
        idx = i

goukei = 0

for i, r in enumerate(ryouri):
    if i == idx:
        goukei += r
    elif r % 10 == 0:
        goukei += r
    else:
        goukei += r + (10 - (r % 10))

print(goukei)

Submission status: Accepted

Solution code:
import numpy as np







def up(x):
	return x+10*(x%10!=0)-x%10



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

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

m=np.array([i%10+10*(i%10==0) for i in l])
a=np.argmin(m)
out=0
for i in range(5):
	if(i==a):
		out+=l[i]
	else:
		out+=up(l[i])	

print(out)

Submission status: Accepted

Solution code:
import math

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

menus = [a, b, c, d, e]
ceils = [math.ceil(a/10)*10, math.ceil(b/10)*10, math.ceil(c/10)*10, math.ceil(d/10)*10, math.ceil(e/10)*10]

minIndex = 0
minTime = 10
for i in range(5):
    tmp = menus[i]%10
    if(tmp!=0):
        if(minTime>tmp):
            minTime = tmp
            minIndex = i
ans = 0
for i in range(5):
    if(i==minIndex):
        ans += menus[i]
    else:
        ans += ceils[i]

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
import math
import numpy as np
# N = int(stdin.readline().rstrip().split()[0])
# A = [int(x) for x in stdin.readline().rstrip().split()]
# N, X = [int(x) for x in stdin.readline().rstrip().split()]
# S = [int(x) for x in stdin.readline().rstrip().split()]
x = []
for i in range(5):
  x.append(int(stdin.readline().rstrip().split()[0]))

x10 = [(int((i-1)/10)+1)*10 for i in x]
y = np.array([j-i for i, j in zip(x10,x)])
mini = np.min(y)
print(sum(x10)+mini)

Submission status: Accepted

Solution code:
a=input()
b=input()
c=input()
d=input()
e=input()
L=[int(a[-1]),int(b[-1]),int(c[-1]),int(d[-1]),int(e[-1])]
M=[int(a),int(b),int(c),int(d),int(e)]
for i in range(5):
  if L[i] != 0:
    M[i] = M[i] + 10 - L[i]
  else:
    L[i] = 10
print(sum(M)+min(L)-10)

Submission status: Accepted

Solution code:
import sys
def p(*a):
  s=" ".join(map(str,a))
  #print(s)
  sys.stderr.write(s+"\n")

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

amod= a%10
bmod= b%10
cmod= c%10
dmod= d%10
emod= e%10

p(a,b,c,d,e)
p(amod,bmod,cmod,dmod,emod)

x=9

from math import ceil

if amod==bmod==cmod==dmod==emod==0:
  ans=a+b+c+d+e
else:
  if amod!=0: x=min(x,amod)
  if bmod!=0: x=min(x,bmod)
  if cmod!=0: x=min(x,cmod)
  if dmod!=0: x=min(x,dmod)
  if emod!=0: x=min(x,emod)
  ans= (ceil(a/10)*10)+(ceil(b/10)*10)+(ceil(c/10)*10)+(ceil(d/10)*10)+(ceil(e/10)*10)-10+x

print(ans)

Submission status: Accepted

Solution code:
hoge=[]
for i in range(5):
  hoge.append(int(input()))
  
ans=0
yobun=[]
for i in range(5):
  if(hoge[i]%10==0):
    yobun.append(10)
    ans+=hoge[i]
  else:
    yobun.append(hoge[i]%10)
    ans+=+10+hoge[i]-hoge[i]%10
    
hiku=min(yobun)
if(min(yobun)==10):
  print(sum(hoge))
else:
  print(ans+hiku -10)

Submission status: Accepted

Solution code:
from itertools import permutations

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

def calc(perm):
    time = 0
    for p in perm:
        if (time % 10 == 0):
            time += ary[p]
        else:
            time += 10 - time % 10
            time += ary[p]
    return time

times = []
for perm in permutations(range(5)):
    times.append(calc(perm))

print(min(times))

Submission status: Accepted

Solution code:
import itertools
o = [int(input()) for i in range(5)]
check = 110000000000000000000000000000000000000000000000000000000000000000000000
g = itertools.permutations(o)
for ls in g:
    ans = 0
    for i in range(5):
        if ls[i] % 10 == 0:ans += ls[i]
        else:ans += ls[i] + (10 - ls[i] % 10)
    if ls[-1] % 10 != 0:
        ans -= 10-(ls[-1] % 10)
    check = min(ans,check)
print(check)

Submission status: Accepted

Solution code:
m=[int(input()) for _ in range(5)]
print(sum([(1+t//10)*10 if t%10>0 else t for t in m])
      -max([(1+t//10)*10-t if t%10>0 else 0 for t in m]))

Submission status: Accepted

Solution code:
list=[]
ans=10
sum=0
for i in range(5):
    list.append(int(input()))
for i in range(5):
    if list[i]%10<ans and list[i]%10!=0:
        ans=list[i]%10
for j in range(5):
    if list[j]%10!=0:
        sum+=list[j]+(10-list[j]%10)
    else:
        sum+=list[j]
print(sum-(10-ans))

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]
total = []
for v in itertools.permutations(l):
    nl = list(v)
    t = 0
    for num in range(len(nl)):
        if(num != 4 and nl[num] % 10 != 0):
            t += int(nl[num] / 10) * 10 + 10
        else:
            t += nl[num]
    t = int(t)
    total.append(t)
print(min(total))

Submission status: Accepted

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

max_read = 0

def spend(t):
    global max_read
    if t % 10 == 0:
        return t
    else:
        ret = (t // 10 + 1) * 10
        max_read = max(max_read, ret-t)
        return ret
    


result = 0
result += spend(A)
result += spend(B)
result += spend(C)
result += spend(D)
result += spend(E)
print(result - max_read)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
MA = ((A - 1) // 10 + 1) * 10
MB = ((B - 1) // 10 + 1) * 10
MC = ((C - 1) // 10 + 1) * 10
MD = ((D - 1) // 10 + 1) * 10
ME = ((E - 1) // 10 + 1) * 10
ma = (A + 9) % 10 + 1
mb = (B + 9) % 10 + 1
mc = (C + 9) % 10 + 1
md = (D + 9) % 10 + 1
me = (E + 9) % 10 + 1
min = min (ma, mb, mc, md, me)
print(MA + MB + MC + MD + ME - 10 + min)

Submission status: Accepted

Solution code:
a, b, c, d, e = [int(input()) for _ in range(5)]
l = [0 if str(i)[-1] == '0' else 10 - int(str(i)[-1]) for i in [a, b, c, d, e]]
ll = [a, b, c, d, e]
arr = []
for i in range(5):
    arr.append([l[i], ll[i]])
arr.sort()
ans = 0
for index, (i, j) in enumerate(arr):
    if index == len(arr) - 1:
        ans += j
    else:
        ans += i + j
print(ans)

Submission status: Accepted

Solution code:
a=[0,0,0,0,0]
a[0]=int(input())
a[1]=int(input())
a[2]=int(input())
a[3]=int(input())
a[4]=int(input())
suma=0
Max=0
for i in range(5):
  if a[i]%10==0:
    suma+=a[i]
  else:
    suma+=a[i]//10*10+10
    if Max<(a[i]//10*10+10)-a[i]:
      Max=(a[i]//10*10+10)-a[i]  
print(suma-Max)

Submission status: Accepted

Solution code:
times = []
for _ in range(5):
    t = int(input())
    times.append((((t - 1) // 10) * 10, (t - 1) % 10 + 1))
times.sort(key=lambda x: x[1])
ans = 0
for x, r in times[1:]:
    ans += x + 10
ans += sum(times[0])
print(ans)

Submission status: Accepted

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

def solve():
    menus = []
    for i in range(0, 5):
        menus.append(int(input()))
    
    # １の位が最も小さいものを最後に注文する。あとはなんでもいい
    amari = 10
    last = 0
    for i in range(0, 5):
        if menus[i]%10 < amari and menus[i]%10 != 0:
            last = i
            amari = menus[i]%10
    
    ans = 0
    for i in range(0, 5):
        if i == last:
            continue

        ans += menus[i]
        ans = math.ceil(ans/10) * 10
    
    ans += menus[last]
    print(ans)



if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
a=A
b=B
c=C
d=D
e=E
a_=0
b_=0
c_=0
d_=0
e_=0
if A%10!=0:
  a=(((A//10)+1)*10)
  a_=10-A%10
if B%10!=0:
  b=(((B//10)+1)*10)
  b_=10-B%10
if C%10!=0:
  c=(((C//10)+1)*10)
  c_=10-C%10
if D%10!=0:
  d=(((D//10)+1)*10)
  d_=10-D%10
if E%10!=0:
  e=(((E//10)+1)*10)
  e_=10-E%10
print(a+b+c+d+e-max(a_,b_,c_,d_,e_))

Submission status: Accepted

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

sorted_a = sorted(a,key = lambda x: (x - 1) % 10,reverse = True)
sum_time = 0
for i in range(5):
  while sum_time % 10 != 0:
    sum_time += 1
  sum_time += sorted_a[i]

print(sum_time)

Submission status: Accepted

Solution code:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
last=A
for m in (B,C,D,E):
    if m%10<last%10 and m%10!=0:
        last=m
ans=last
l=[A,B,C,D,E]
l.remove(last)
for m in l:
    ans+=((m+9)//10)*10
print(ans)