본문 바로가기
python-algorithm

[백준] 1350

by 무적김두칠 2021. 1. 6.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import sys
n=int(sys.stdin.readline())
if n>1:
    tmp=list(map(int, sys.stdin.readline().split()))
    cluster=int(sys.stdin.readline())
    cnt=0
    for i in range(n):
        if tmp[i]!=0:
            if tmp[i]%cluster!=0:
                cnt+=(tmp[i]//cluster) +1
            else: cnt+= tmp[i]//cluster
    print(cnt*cluster)
else:
    tmp=int(sys.stdin.readline())
    cluster=int(sys.stdin.readline())
    if tmp%cluster==0print(tmp)
    elseprint(cluster*(tmp//cluster +1))
cs
반응형

'python-algorithm' 카테고리의 다른 글

[백준] 1434  (0) 2021.01.06
[백준] 1392  (0) 2021.01.06
[백준] 1264  (0) 2021.01.06
[백준] 1233  (0) 2021.01.05
[백준] 1225  (0) 2021.01.05

댓글