We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f0c8f8 commit 92d7fc2Copy full SHA for 92d7fc2
1 file changed
Gold/boj_2293_동전1.java
@@ -0,0 +1,26 @@
1
+import java.io.BufferedReader;
2
+import java.io.*;
3
+import java.util.*;
4
+public class boj_2293_동전1 {
5
+ public static void main(String[] args)throws IOException {
6
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
7
+ StringTokenizer st = new StringTokenizer(br.readLine());
8
+ int N = Integer.parseInt(st.nextToken());
9
+ int K = Integer.parseInt(st.nextToken());
10
+ int [] num = new int[N];
11
+ for(int i=0; i<N; i++){
12
+ num[i] = Integer.parseInt(br.readLine());
13
+ }
14
+ int[] dp = new int[K+1];
15
+ dp[0]=1;
16
+
17
18
+ for(int j=num[i]; j<=K; j++){
19
+ dp[j]+=dp[j-num[i]];
20
21
22
23
+ System.out.println(dp[K]);
24
25
26
+}
0 commit comments