-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path_11047.java
More file actions
32 lines (26 loc) ยท 835 Bytes
/
_11047.java
File metadata and controls
32 lines (26 loc) ยท 835 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
package backjoon;
// https://www.acmicpc.net/problem/11047
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class _11047 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int N = Integer.parseInt(st.nextToken()); // ๋์ ์ข
๋ฅ
int K = Integer.parseInt(st.nextToken()); // ๊ฐ์น
int[] coin = new int[N];
for(int i = 0; i < N; i++) {
coin[i] = Integer.parseInt(br.readLine());
}
int min = 0;
for(int i= N-1; i >= 0; i--){
if(coin[i] <= K){
min += (K / coin[i]);
K = K % coin[i];
}
}
System.out.println(min);
}
}