File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ package backjoon ;
2
+ // https://www.acmicpc.net/problem/11047
3
+
4
+ import java .io .BufferedReader ;
5
+ import java .io .IOException ;
6
+ import java .io .InputStreamReader ;
7
+ import java .util .StringTokenizer ;
8
+
9
+ public class _11047 {
10
+ public static void main (String [] args ) throws IOException {
11
+
12
+ BufferedReader br = new BufferedReader (new InputStreamReader (System .in ));
13
+ StringTokenizer st = new StringTokenizer (br .readLine (), " " );
14
+ int N = Integer .parseInt (st .nextToken ()); // ๋์ ์ข
๋ฅ
15
+ int K = Integer .parseInt (st .nextToken ()); // ๊ฐ์น
16
+
17
+ int [] coin = new int [N ];
18
+
19
+ for (int i = 0 ; i < N ; i ++) {
20
+ coin [i ] = Integer .parseInt (br .readLine ());
21
+ }
22
+
23
+ int min = 0 ;
24
+ for (int i = N -1 ; i >= 0 ; i --){
25
+ if (coin [i ] <= K ){
26
+ min += (K / coin [i ]);
27
+ K = K % coin [i ];
28
+ }
29
+ }
30
+ System .out .println (min );
31
+ }
32
+ }
You canโt perform that action at this time.
0 commit comments