-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_22993.java
More file actions
39 lines (27 loc) · 840 Bytes
/
BOJ_22993.java
File metadata and controls
39 lines (27 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package ps;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class BOJ_22993 {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(in.readLine());
StringTokenizer st = new StringTokenizer(in.readLine());
long junwon = Integer.parseInt(st.nextToken());
long[] arr = new long[N - 1];
for (int i = 0; i < N - 1; i++) {
arr[i] = Integer.parseInt(st.nextToken());
}
Arrays.sort(arr);
long power = junwon;
for (int i = 0 ; i < N - 1; i++) {
if(power <= arr[i]) {
System.out.println("No");
return;
}
power += arr[i];
}
System.out.println("Yes");
}
}