-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ12788.java
More file actions
35 lines (33 loc) · 1021 Bytes
/
BOJ12788.java
File metadata and controls
35 lines (33 loc) · 1021 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
package ¹éÁØ;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;
public class BOJ12788 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
StringTokenizer st = new StringTokenizer(br.readLine());
int member = Integer.parseInt(st.nextToken()) * Integer.parseInt(st.nextToken());
ArrayList<Integer> list = new ArrayList<>();
st = new StringTokenizer(br.readLine());
for(int i = 0; i < N; i++) {
list.add(Integer.parseInt(st.nextToken()));
}
Collections.sort(list, Collections.reverseOrder());
int cnt = 0;
int count = 0;
while(member > 0 && count != N) {
member -= list.get(cnt++);
count++;
}
if(member <= 0) {
System.out.print(count);
}
else {
System.out.print("STRESS");
}
}
}