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

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

def roundUp(x):
    '''
    Takes integer x.
    Returns x rounded up to the next multiple of 10
    '''

    while x%10 != 0:
        x = x + 1
    return x

arounded = (a-1)%10
brounded = (b-1)%10
crounded = (c-1)%10
drounded = (d-1)%10
erounded = (e-1)%10
if min(arounded, brounded, crounded, drounded, erounded) == arounded:
    print(roundUp(b) + roundUp(c) + roundUp(d) + roundUp(e) + a)
elif min(arounded, brounded, crounded, drounded, erounded) == brounded:
    print(roundUp(a) + roundUp(c) + roundUp(d) + roundUp(e) + b)
elif min(arounded, brounded, crounded, drounded, erounded) == crounded:
    print(roundUp(b) + roundUp(a) + roundUp(d) + roundUp(e) + c)
elif min(arounded, brounded, crounded, drounded, erounded) == drounded:
    print(roundUp(b) + roundUp(c) + roundUp(a) + roundUp(e) + d)
else:
    print(roundUp(b) + roundUp(c) + roundUp(d) + roundUp(a) + e)

Submission status: Accepted

Solution code:
from itertools import permutations

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

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

perm_times = list(permutations(cook_time))

result_time = 10**9

for perm_time in perm_times:
    total_time = 0
    cnt = 0
    for time in perm_time:
        cnt += 1
        if time % 10 != 0 and cnt != 5:
            total_time += time + 10 - time % 10
        else:
            total_time += time
        
    if result_time > total_time:
        result_time = total_time
        
    
    
print(result_time)

Submission status: Accepted

Solution code:
diff = 1000
total = 0

for i in range(5) :
    time = int(input())
    if time % 10 > 0 :
        diff = min(diff,time % 10)
    total += int((time + 9) / 10) * 10

if diff == 1000 :
    print(total)
else :
    print(total - 10 + diff)

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
t1 = 0
t2 = []
for a in t:
    if a % 10 == 0:
        t1 += a
    else:  
        t1 += (a//10 + 1)*10
        t2.append(a % 10)
if t2 == []:
    print(t1)
else:
    print(t1 + min(t2) - 10)

Submission status: Accepted

Solution code:
t = [int(input()) for i in range(5)]
t1 = 0
t2 = []
for a in t:
  if a % 10 == 0:
    t1 += a
  else:  
    t1 += (a//10 + 1)*10
    t2.append(a % 10)
if t2 == []:
  print(t1)
else:
  print(t1 + min(t2) - 10)

Submission status: Accepted

Solution code:

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

min_i = 0
min_rest = 10
times = []
for i, x in enumerate(l):
    rest = x%10
    if rest > 0:
        times.append((x//10)*10+10)
        if rest < min_rest:
            min_i = i
            min_rest = rest
    else:
        times.append(x)

print(sum(times[:min_i])+sum(times[min_i+1:])+l[min_i])

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
mozi = [a, b, c, d, e]
rup = [round(mozi[i], -1) if mozi[i] % 10 == 0 else
       round(mozi[i] + 5, -1)
       for i in range(len(mozi))]

amari = [mozi[i] % 10 if mozi[i] % 10 != 0 else
         10 for i in range(len(mozi))]

m_r_a = list(zip(mozi, rup, amari))
sorta_m_r_a =(sorted(m_r_a, key=lambda x:x[2], reverse=True))

dishes_4sum = 0
for i in range(4):
    dishes_4sum += sorta_m_r_a[i][1]
dishes_5sum = dishes_4sum + sorta_m_r_a[4][0]

print(dishes_5sum)

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(5)]
def A(i):
    return 10-(i-1)%10
l.sort(key=A)
t=0
for i in range(4):
    if l[i]%10==0:
        t+=l[i]
    else:
        t+=l[i]//10*10+10
print(t+l[4])

Submission status: Accepted

Solution code:
li = []
count = 0

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

    amari = list(map(lambda x: x % 10, li))
    sho = list(map(lambda x: x // 10, li))

for j in range(5):
    if amari[j] != 0:
        sho[j] = (sho[j]+1)*10
    else:
        sho[j] = sho[j]*10
        count += 1
        amari[j] += 123

if count == 5:
    print(sum(sho))
else:
    print(sum(sho) - 10 + min(amari))

Submission status: Accepted

Solution code:
ans = 0
Ri = 0 # 10 - inputを10で割ったあまり
Rm = 0 # 10 - inputを10で割ったあまりの最大値

for _ in range(5):
	I = int(input())

	# 調理後の待ち時間がある場合はその時間を算出
	if I%10 != 0:
		Ri = 10 - I%10

	# 調理時間を10分単位で加算
	ans += 10 * ((I + 9)//10) 

	# 調理後の待ち時間の最大値を入れ替え
	if Ri > Rm:
		Rm = Ri 

# 調理時間の合計から、待ち時間の最大値を引き答えとする
ans = ans - Rm

# 解答
print(ans)

Submission status: Accepted

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

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



for x in li:
    if x % 10 != 0:
        li_nonzero.append(x)

if len(li_nonzero) == 0:
    last_menu = li[4]
    li.remove(li[4])
else:
    z = li_nonzero[0]%10
    for y in li_nonzero:
        if y % 10 <= z:
            z = y%10
            last_menu = y
            
    li.remove(last_menu)

if len(li) < 4:
    while(len(li)==4):
        li.append(last_menu)
sum_time = 0
for menu in li:
    if menu % 10 != 0:
        sum_time = sum_time +( (menu//10)*10+10)
    else:
        sum_time = sum_time +( (menu//10)*10+0)
        
    
print(sum_time+last_menu)

Submission status: Accepted

Solution code:
times = []
min_unit_place = 9
min_unit_index = None

for i in range(5):
  time_i = input()
  times.append(int(time_i))
  unit_place = int(time_i[-1])
  if unit_place > 0 and min_unit_place >= unit_place:
    min_unit_place = unit_place
    min_unit_index = i
  
answer = 0
for i, t in enumerate(times):
  if i == min_unit_index or t%10 == 0:
    answer += t
  else:
    answer = answer + t + (10-t%10)

print(answer)

Submission status: Accepted

Solution code:
order = []
amari = []
show = []
sum = 0
for i in range(5):
  order.append(int(input()))
  s = order[i] % 10
  if(s == 0):
    s = 10
  t = order[i] - s + 10
  amari.append(s)
  sum += t
ans = sum - 10 + min(amari)
print(ans)

Submission status: Accepted

Solution code:

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

m = 0
res = 0

for x in A:
    if x%10 == 0:
        t = 0
    else:
        t = 10 - x%10
    res += x+t
    
    m = max(m,t)
    
print(res-m)

Submission status: Accepted

Solution code:
Time = []
Time_Zero = []

for i in range(5):
    A = int(input())
    ra = A%10
    qa = A//10
    if ra == 0:
      Time_Zero.append([ra,qa,A])
    else:
      Time.append([ra,qa,A])

Time.sort(reverse=True)

ans = 0
for r,q,A in Time_Zero:
  ans += 10*q

for r,q,A in Time:
  ans += 10*(q+1)

if len(Time) > 0:
  ans += Time[-1][2] - 10*(Time[-1][1]+1)

print(ans)

Submission status: Accepted

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

all_list = [A, B, C, D, E]
amari = [A%10, B%10, C%10, D%10, E%10]
amari = [ 10 if i == 0 else i for i in amari]
min_index = amari.index(min(amari))
amari = [ 0 if i == 10 else i for i in amari]
goukei = 0
for i, one in enumerate(all_list):
    if i != min_index:
        if one%10 > 0:
            goukei += one + (10-one%10)
        else:
            goukei += one
goukei += all_list[min_index]
print(goukei)

Submission status: Accepted

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

total = 0
n = 0
mod10 = [i%10 for i in time]
mod10_l = []
for i in mod10:
    if i > 0:
        mod10_l.append(i)
for i,j in zip(mod10, time):
    if i == 0:
        total += j
    elif n == 0 and i == min(mod10_l):
        total += j
        n += 1
    else:
        total += j + 10-i
print(total)

Submission status: Accepted

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

ans = 0
x = 10

for i in range(5):
    if menu[i] % 10 == 0:
        ans += menu[i]
    else:
        x = min(x, menu[i] % 10)
        ans += (menu[i] // 10 + 1)*10

ans -= 10-x

print(ans)

Submission status: Accepted

Solution code:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
All = [A, B, C, D, E]
_All = [A, B, C, D, E]
late = 10
late_menu = 0
total = 0
for menu in All:
    if menu % 10 == 0:
        total += menu
        _All.remove(menu)
if len(_All)>=1:
    for menu1 in _All:
        if menu1 % 10 <= late:
            late = menu1 % 10
            late_menu = menu1
    _All.remove(late_menu)
for x in _All:
    if x <= 10:
        x = 10
        total += x
    else:
        x = (x // 10 +1) * 10
        total += x
total = total + late_menu
print(total)

Submission status: Accepted

Solution code:
import math
from functools import reduce
from operator import add
from operator import sub


def round_up(x, y):

    if x % 10 == 0:
        return x
    else:
        roundup = int((x / y) + 1) * y
        return roundup


# int型
cook_time = [int(input()) for i in range(5)]
# 1の位を0へ
cook_time_round = list(map(lambda x: round_up(x, 10), cook_time))
# cook_time - cook_time_round
cook_time_difference = list([sub(x, y) for x, y in zip(cook_time_round, cook_time)])
# 合計時間
total_time = reduce(add, cook_time_round)

print(total_time - reduce(max, cook_time_difference))

Submission status: Accepted

Solution code:
dish = [int(input()) for i in range(5)]
reeltime = sorted([10 - (x%10) if x%10 != 0 else (x%10) for x in dish])
print(sum(dish)+sum(reeltime[:-1]))

Submission status: Accepted

Solution code:
dish = [int(input()) for i in range(5)]
reeltime = [10 - (x%10) if x%10 != 0 else (x%10) for x in dish]
a, b = 0, 0
for i, j in zip(dish, sorted(reeltime)):
    a += i
    b += 1
    if b != len(dish):
        a += j
print(a)

Submission status: Accepted

Solution code:
a = [int(input()) for _ in range(5)]
def ceil(x):
  if x % 10 != 0:
    return 10 * ((x // 10) + 1)
  else:
    return x
sum = 0
min = 10
for i in range(5):
  sum = sum + ceil(a[i])
  if a[i] % 10 != 0 and a[i] % 10 < min:
    min = a[i] % 10
print(sum - 10 + min)

Submission status: Accepted

Solution code:
a=list(map(int, [input() for i in range(5)]))
b=map(lambda x:(10-(x%10))%10, a)
ans=0
for i in range(5):
    ans+=a[i]
    if (a[i]%10)!=0:
        ans+=10-(a[i]%10)
print(ans-max(b))

Submission status: Accepted

Solution code:
import sys
import os


time=0
tmax=10
for i in range(5):
    a=int(input())
    if a%10==0:
        time +=a
    else:
        time += a-a%10+10
        tmax=min(tmax,a%10)
    #tmin=max(tmax,a%10)
print(time+tmax-10)

Submission status: Accepted

Solution code:
Times =[int(input())for i in range(5)]
def realtime(n):
    return (-(-n//10))*10

def amari(n):
    if n%10 == 0:
        return 10
    else:
        return n%10

Realtimes = list(map(realtime,Times))
amaris = list(map(amari,Times))
finalist = amaris.index(min(amaris))

ans = sum(Realtimes) + Times[finalist] - Realtimes[finalist]
print(ans)

Submission status: Accepted

Solution code:
# B - Five Dishes
import math

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

time = 0
mini = 10
for x in n:
    rest = x%10
    if rest != 0:
        mini = min(rest, mini)
    while x%10 != 0:
        x = math.ceil(x/10)*10
    time += x
print(time-10+mini)

Submission status: Accepted

Solution code:
# B - Five Dishes

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

time = 0
mini = 10
for x in n:
    rest = x%10
    if rest != 0:
        mini = min(rest, mini)
    while x%10 != 0:
        x += 1
    time += x
print(time-10+mini)

Submission status: Accepted

Solution code:
a=[0]*5
for i in range(5):
    a[i]=int(input())
ha=10
for i in range(5):
    if a[i]%10!=0:
        ha=min(ha,a[i]%10)
ans=0
for i in range(5):
    if a[i]%10==0:
        ans+=a[i]
    else:
        ans+=a[i]+(10-a[i]%10)
print(ans-(10-ha))

Submission status: Accepted

Solution code:
def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li.append(int(input()))
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= max(li)

print(ans)

Submission status: Accepted

Solution code:
import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dat = [a,b,c,d,e]
dattime = map
tindex = 0
tnum = 10

for i in range(5):
    t = dat[i] % 10
    t = 10 if t == 0 else t
    if tnum > t:
        tindex = i
        tnum = t

sum = 0

for i in range(5):
    if i != tindex:
        sum += int( math.ceil(dat[i] / 10) * 10 )
    else:
        sum += dat[i]
print(sum)

Submission status: Accepted

Solution code:
a = []
low = 10
ans = 0
for i in range(5):
    a.append(int(input()))
    if a[i] % 10 != 0:
        low = min(low, a[i]%10)
    while (a[i] % 10 != 0):
        a[i] += 1
    ans += a[i]

if low != 10:
    print(ans - 10 + low)
else:
    print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    v = []
    for _ in range(5):
        v.append(int(input()))
    v.sort()

    ans = INF
    for p in permutations(v):
        t = 0
        for x in p:
            if t % 10 != 0:
                t += 10 - (t % 10)
            t += x

        ans = min(ans, t)

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    a = [int(input()) for i in range(5)]
    a.sort(key=lambda x: x%10 if x%10 != 0 else 10, reverse=True)
    ans = 0
    for aa in a[:4]:
        if aa%10 != 0:
            ans += aa+(10-aa%10)
        else:
            ans += aa
    ans += a[4]
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
lis = [int(input()) for _ in range(5)]
lis = sorted(lis,key=lambda x:(10-(x%10))%10,reverse=True)
lis = [(j+9)//10*10 if i != 0 else j for i,j in enumerate(lis)]
print(sum(lis))

Submission status: Accepted

Solution code:
i = [int(input()) for i in range(5)]
i2 = [i2 for i2 in i if i2%10 != 0]

if not i2:
    min = i[len(i)-1]

else:
    min = i2[len(i2)-1]

for x in i:
    if 0 < x % 10 < min % 10:
        min = x
i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

i.append(min)

print(sum(i))

Submission status: Accepted

Solution code:
order_time = [0, 0, 0, 0, 0]
order = len(order_time)
time = 0
last_order = 9
count_change = 0

for i in range(0, order):
    order_time[i] = int(input())
    if (order_time[i] % 10 != 0) and (order_time[i] % 10 <= last_order % 10):
        last_order = order_time[i]
        count_change += 1

for i in range(0, order):
    if order_time[i] % 10 != 0:
        time += order_time[i] // 10 * 10 + 10
    else:
        time += order_time[i]

if count_change == 0:
    last_order = 0
else:
    time -= last_order // 10 * 10 + 10
    time += last_order

print(time)

Submission status: Accepted

Solution code:
def addTime(x):
  return (x + 9) // 10 * 10

def diff(x):
  return addTime(x) - x

def main():
  a = [int(input()) for i in range(5)]
  ans = 0
  for i in a:
    ans = ans + addTime(i)
  
  diffList = []
  for i in a:
    diffList.append(diff(i))

  ans = ans - max(diffList)
  print(ans)

main()

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]
  
minimam = 10
sum = 0
  
for i in list:
  if i%10 < minimam and i%10 != 0:
    minimam = i%10
  sum += ((i+9)//10)*10

print(sum-10+minimam)

Submission status: Accepted

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

def make_ten(i):
    ans = 0
    while i % 10 != 0:
        i += 1
        ans += 1
    return [i,ans]

anslist = []
diflist = []
for i in range(5):
    anslist.append(make_ten(A[i])[0])
    diflist.append(make_ten(A[i])[1])

print(sum(anslist)-max(diflist))

Submission status: Accepted

Solution code:
i = [int(input()) for i in range(5)]
i2 = [i2 for i2 in i if i2%10 != 0]

if not i2:
    min = i[len(i)-1]

else:
    min = i2[len(i2)-1]

count = 0
for x in i:
    if 0 < x % 10 < min % 10:
        min = x
        count += 1
i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

i.append(min)

print(sum(i))

Submission status: Accepted

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

sub = []
t = 0

for line in l:
    t += line
    sub.append((10 - line % 10) % 10)

t += sum(sub) - max(sub)
print(t)

Submission status: Accepted

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

s = 0
sabun = []

s += a
sabun.append((10 - a % 10) % 10)
s += b
sabun.append((10 - b % 10) % 10)
s += c
sabun.append((10 - c % 10) % 10)
s += d
sabun.append((10 - d % 10) % 10)
s += e
sabun.append((10 - e % 10) % 10)

s += sum(sabun) - max(sabun)
print(s)

Submission status: Accepted

Solution code:
import math

list = []
for i in range(5):
    list.append(int(input()))
sum = 0
zeroList = [list[i] for i in range(len(list)) if list[i]%10 == 0]
otherList = [list[i] for i in range(len(list)) if not list[i]%10 == 0]
def func(x):
    return x % 10
otherList.sort(key=func)
for i in range(len(zeroList)):
    sum += zeroList[i]
for i in (otherList[1:]):
    sum += math.ceil(i/10)*10
if not len(otherList) == 0:
    sum += otherList[0]
print(sum)

Submission status: Accepted

Solution code:
a = [0 for _ in range(5)]
b = [0 for _ in range(5)]

for i in range(5):
    d = int(input())
    a[i] = d // 10
    if d % 10 != 0:
        a[i] += 1
    b[i] = (d-1) % 10

print((sum(a) - 1) * 10 + min(b) + 1)

Submission status: Accepted

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

sum = 0
counter = 0

list = [[A,A%10], [B,B%10], [C,C%10], [D,D%10], [E,E%10]]
list = sorted(list, key=lambda x:x[1])
for i in range(4):
    if list[i][1] == 0:
        sum += list[i][0]
        counter += 1
for i in range(len(list)-1,counter,-1):
    if list[i][0] % 10 != 0:
        sum += 10*(list[i][0] // 10 + 1)
    else:
        sum += list[i][0] 
sum += list[counter][0]
print(sum)

Submission status: Accepted

Solution code:
#最後の料理には「調理時間の一の位が0以外の最小である料理」をもってくればよい

Dishes_list = [0] * 5
total_list = [0] * 5
one_rank = 10
total_time = 0

for i in range(0, 5):
    Dishes_list[i] = input()

for i in range(0, 5):
    a = int(Dishes_list[i])
    syo = a // 10
    amari = a % 10
    a = syo * 10
    if amari > 0:
        a += 10
    if (amari < one_rank) and (amari != 0):
        one_rank = amari
    total_list[i] = str(a)

for i in range(0, 5):
    total_time += int(total_list[i])

if one_rank != 0:
    total_time -= 10
    total_time += one_rank

print(total_time)

Submission status: Accepted

Solution code:
import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
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 SI(): return input()
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')

li = []
for i in range(5):
    li.append(II())

sum_ = 0
li_mod = []
for i in li:
    if i%10 == 0:
        sum_ += i
    else:
        sum_ += ((i//10)+1)*10
        li_mod.append(10-i%10)
if li_mod:
    sum_ -= max(li_mod)

print(sum_)

Submission status: Accepted

Solution code:
r=[int(input()) for _ in range(5)]
#1桁目が最小のものを求める
l=0
for i in range(5):
  if r[l]%10>r[i]%10 and r[i]%10!=0:
    l=i
ans=0
for i in range(5):
  if l==i:
    ans+=r[i]
  else:
    ans+=(r[i]+9)//10*10

print(ans)

Submission status: Accepted

Solution code:
s = 0
mod = 0
for _ in range(5):
    i = int(input())
    m = i % 10
    if m != 0:
        if mod == 0:
            mod = m
        else:
            mod = min(mod, m)
        s += (i // 10 + 1) * 10
    else:
        s += i
if mod != 0:
    s = s - 10 + mod

print(s)

Submission status: Accepted

Solution code:
a = [0 for _ in range(5)]

idx = 0
tmp = 9
for i in range(5):
    a[i] = int(input())
    if a[i] % 10 == 0:
        continue
    elif a[i] % 10 < tmp:
        idx = i
        tmp = a[i] % 10
        

ans = 0
for i in range(5):
    if a[i] % 10 == 0 or i==idx:
        ans += a[i]
    else:
        tmp = (a[i] // 10 + 1) * 10
        ans += tmp

print(ans)

Submission status: Accepted

Solution code:
m = 10
f = 0
for _ in range(5):
    k = int(input())
    if k%10==0:
        f += k//10
    else:
        f += k//10+1
        if k%10<m:
            m = k%10
print(10*(f-1)+m)

Submission status: Accepted

Solution code:
list = [int(input()) for i in range(5)]
t = 0
cnt_l = []
for i in range(5):
    cnt = 0
    while list[i] % 10 != 0:
        list[i] += 1
        cnt += 1
    t += list[i]
    if cnt != 0:
        cnt_l.append(cnt)
if not cnt_l:
    cnt_l.append(0)
print(t - max(cnt_l))

Submission status: Accepted

Solution code:
a,b,c,d,e=[int(input()) for i in range(5)]
a1=a//10
a2=a%10
if a2==0:
    a1-=1
    a2=10
b1=b//10
b2=b%10
if b2==0:
    b1-=1
    b2=10
c1=c//10
c2=c%10
if c2==0:
    c1-=1
    c2=10
d1=d//10
d2=d%10
if d2==0:
    d1-=1
    d2=10
n=e//10
m=e%10
if m==0:
    n-=1
    m=10
min1=min(a2,b2,c2,d2,m)
ans=(a1+b1+c1+d1+n+4)*10+min1
print(ans)

Submission status: Accepted

Solution code:
a,b,c,d,e=[int(input()) for i in range(5)]
a1=a//10
a2=a%10
if a2==0:
    a1-=1
    a2=10
b1=b//10
b2=b%10
if b2==0:
    b1-=1
    b2=10
c1=c//10
c2=c%10
if c2==0:
    c1-=1
    c2=10
d1=d//10
d2=d%10
if d2==0:
    d1-=1
    d2=10
n=e//10
m=e%10
if m==0:
    n-=1
    m=10
min1=min(a2,b2,c2,d2,m)
if a2==10 or b2==10 or c2==10 or d2==10 or m==10:
    ans=(a1+b1+c1+d1+n+4)*10+min1
else:
    ans=(a1+b1+c1+d1+n+4)*10+min1
print(ans)

Submission status: Accepted

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

min = 9
num = 0
for i in range(len(A)):
    if min > A[i]%10 and A[i] % 10 != 0:
      min = A[i]%10
      num = i
      
ans = 0
for i in range(5):
  if i != num:
    ans = ans + int((A[i]+9)/10) * 10
ans = ans + A[num]

print(ans)

Submission status: Accepted

Solution code:
t=0
for i in sorted(map(int,list(open(0))),key=lambda x:-x%10-(x%10<1)):t+=i+(10-t)%10
print(t)

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

order = [int(input()) for _ in range(5)]
ans = 0
last = INF
for i in range(5):
    ans += ((order[i]-1)//10+1) * 10
    last = min(last,(order[i]-1)%10+1)

print(ans-10+last)

Submission status: Accepted

Solution code:
menu = [int(input()) for ii in range(0,5)]
remainder=[0]*len(menu)

for ii in range(0,len(menu)):
    remainder[ii] =abs(10-menu[ii] % 10)
    if remainder[ii] == 10:
        remainder[ii]=0

final_menu_index = remainder.index(max(remainder))

print(sum(menu)+sum(remainder)-remainder[final_menu_index])

Submission status: Accepted

Solution code:


def sub():
    items = [int(input()) for _ in range(5)]
    ms = [e % 10 for e in items]

    minIdx = None
    minMod = 11
    for i, m in enumerate(ms):
        if m == 0:
            continue
        if m < minMod:
            minMod = m
            minIdx = i
    if minIdx is None:
        print(sum(items))
        return
    others = items[:minIdx] + items[minIdx+1:]
    cum = 0
    for a in others:
        m = a % 10
        if m == 0:
            cum = cum + a
        else:
            cum = cum + a + (10 - m)
    cum = cum + items[minIdx]
    print(cum)

sub()

Submission status: Accepted

Solution code:
t=0
for i in sorted([int(input())for i in' '*5],key=lambda x:-x%10-(x%10<1)):t+=i+(10-t)%10
print(t)

Submission status: Accepted

Solution code:
t=0
for i in sorted([int(input())for i in' '*5],key=lambda x:-x%10-(x%10<1)):t+=i+(10-t%10)%10
print(t)

Submission status: Accepted

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

time = []
min = 10

for dish in dishes:
    if dish % 10 == 0:
        time.append(dish)
    else:
        time.append((dish // 10 + 1)* 10)
        if min > dish % 10:
            min = dish % 10

print(sum(time) - (10 - min))

Submission status: Accepted

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

result = 0

hasuu = [item % 10 for item in [A, B, C, D, E] if item % 10 != 0]

for item in [A, B, C, D, E]:
  if item % 10 == 0:
    result += item 
  else:
    result += (item // 10 + 1) * 10
    
if hasuu != []:
  result = int(result - 10 + min(hasuu))

print(result)

Submission status: Accepted

Solution code:
N=5
s= list(int(input()) for i in range(N))

ans=0
min=10
for a in s:
  if a%10==0:
    ans+=a
  else:
    ans+=a+(10-(a%10))
    if min>a%10:
      min=a%10
    
print(ans+min-10)

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]
g = 0
sm = f[0]%10
for i in f:
    if i %10 == 0:
        g = g+ i
    else:
        g = g + 10*(i//10)+10
        if i%10 < sm:
            sm = i%10
if sm == 0:
    print(g)
else:
    print(sm+g-10)

Submission status: Accepted

Solution code:
l=[int(input()) for i in range(5)]
L=[(l[i]-1)//10+1 for i in range(5)]
l_1=[(l[i]-1)%10+1 for i in range(5)]
print(10*sum(L)+min(l_1)-10)

Submission status: Accepted

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

ans = 0
min_val = 99
flag = False

for i in range(5):
  if l[i][-1] == "0":
    ans += int(l[i])
  else:
    if int(l[i][-1]) <= int(str(min_val)[-1]):
      if flag:
        ans += (-(-int(min_val)//10))*10
      flag = True
      min_val = l[i]
    else:
      ans += (-(-int(l[i])//10))*10
if flag:
  ans += int(min_val)
print(ans)

Submission status: Accepted

Solution code:
import math
elements = [int(x) for i in range(5) for x in input().split()]
sum = 0
elements = sorted(elements,key=lambda x: x%10 if(x%10==0) else 10-x%10)
for i in range(len(elements)):

    if(elements[i]%10 == 0 or i == 4):
        sum+= elements[i]
    else:
        sum+= elements[i] + 10 - elements[i]%10
print(sum)

Submission status: Accepted

Solution code:
Lmin=[]
for i in range(5):
    Lmin.append(int(input()))
m=10
ans=0
for j in Lmin:
    ans+=(j//10)*10
    if j%10!=0:
        ans+=10
        if j%10<m:
            m=j%10
ans=ans-10+m
print(ans)

Submission status: Accepted

Solution code:
#Coding: Utf-8
A=[]
B=[]
place=count=total=0

for i in range(5):
    A.append(input())
    place=A[i]
    total=total+int(A[i])
    if int(place[-1])!=0:
        B.append(int(place[-1]))
B.sort()
for j in range(1,len(B)):
    count=count+(10-B[j])

print(total+count)

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import permutations 


def get_time(nums):
    time = 0
    for i, n in enumerate(nums):
        time = time + n
        if i < len(nums) - 1 and time % 10 != 0:
            time = time + (10 - time % 10)
    return time


def solve(nums):
    min_time = 0
    for p in permutations(nums, len(nums)):
        t = get_time(p)
        if min_time > t or min_time == 0:
            min_time = t
    return min_time

def main():
    nums = [int(l) for l in stdin.readlines()]
    ans = solve(nums)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

a = sum(list(map(lambda x: ((x-1)//10)*10+10, l)))

b = min(list(map(lambda x: (x-1)%10, l)))+1

print(a + b - 10)

Submission status: Accepted

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

num=[]
min=10
  
for list in time:
  if list%10==0:
    num.append(list)
  else:
    num.append(list+(10-list%10))
    if min>list%10:
      min=list%10

print(sum(num)-(10-min))

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a%10,b%10,c%10,d%10,e%10]
lst.sort()
cnt = 0
for i in range(len(lst)):
  if lst[i] == 0:
    cnt += 1
if cnt == 5:
  print(a+b+c+d+e)
else:
  print((a//10+b//10+c//10+d//10+e//10+4-cnt)*10+lst[cnt])

Submission status: Accepted

Solution code:
a = []
for i in range(5):a.append(int(input()))
mi = 10
sum = 0
for i in a:
	if i % 10 != 0:mi = min(mi,i % 10)
	sum+=(i + 9) // 10 * 10
print(sum - (10 - mi))