본문 바로가기
python-algorithm

[백준] 15780

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

1
2
3
4
5
6
7
8
9
import sys
import math
n,k=map(int,sys.stdin.readline().split())
cnt=0
tmp=list(map(int,sys.stdin.readline().split()))
for i in range(k):
    cnt+= math.ceil( (tmp[i]/2))
if n>cnt: print("NO")
elseprint("YES")
cs

연속으로 꼽으면 안된다는 것을 정의내리는것이
즉, 2로 나누고 버림을 하면 됩니다.

반응형

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

[백준] 15784  (0) 2021.01.04
[백준] 15781  (0) 2021.01.04
[백준] 15667  (0) 2021.01.04
[백준] 14920  (0) 2021.01.04
[백준] 14909  (0) 2021.01.04

댓글