We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e8f8cc0 commit 01fa319Copy full SHA for 01fa319
minjeong/Greedy/2024-08-13-[백준]-#22993-서든어택3.py
@@ -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