Skip to content

Commit 01fa319

Browse files
committed
[BOJ] #22993. 서든어택 3 / 실버3 / 25분 / 성공
1 parent e8f8cc0 commit 01fa319

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
input = sys.stdin.readline
3+
4+
n = int(input())
5+
power = list(map(int, input().split()))
6+
7+
# 준원이를 제외한 나머지 플레이어들의 공격력을 정렬한다.
8+
others = sorted(power[1:])
9+
10+
# 준원이의 초기 공격력
11+
junwon = power[0]
12+
13+
# 나머지 플레이어들과 비교하면서 주원이의 최종 생존 가능 여부를 판단
14+
for p in others:
15+
if junwon > p:
16+
junwon += p
17+
else:
18+
print("No")
19+
exit()
20+
21+
# 모든 플레이어를 이겼다면 "Yes"를 출력
22+
print("Yes")

0 commit comments

Comments
 (0)