Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions 10주차/p2293/나길태/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import java.util.Scanner;

public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();

int[] price = new int[n];
int[] dp = new int[k+1];

dp[0] = 1;

for(int i=0; i<n; i++){
price[i] = sc.nextInt();
}

for (int i = 0; i < n; i++) {
for (int j = 1; j <= k; j++) {
if (j >= price[i])
dp[j] += dp[j - price[i]];
}
}

System.out.println(dp[k]);

}
}