1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import sys
n=int(sys.stdin.readline())
tmp1=(list(map(int, sys.stdin.readline().split())))
jun=tmp1[0]
tmp1.pop(0)
tmp1.sort()
for i in tmp1:
if i<jun :
jun+=i
ans="Yes"
else:
ans="No"
break
if len (tmp1)!=0: print(ans)
else: print("Yes")
|
cs |
어려운 문제는 아니구요
sort해서 풀면 쉬운데
LIne 14-15는 예외처리입니다 준원이 말고 플레이어가 없으면 바로 이기는 경우입니다
반응형
'python-algorithm' 카테고리의 다른 글
Leetcode 1441 Build an Array with Stack Operations (0) | 2021.08.30 |
---|---|
백준 3135 라디오 (0) | 2021.08.30 |
백준 16471 작은 수 내기 (0) | 2021.08.26 |
백준 16435 스네이크버드 (0) | 2021.08.26 |
백준 14469 소가 길을 건너간 이유 3 (0) | 2021.08.26 |
댓글