We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
동전1
### 풀이 언어 - python/java ### 코드 ```python/java ``` ### 핵심 로직 혹은 자료구조 - ### 시간 복잡도 - O( )
The text was updated successfully, but these errors were encountered:
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); String[] split = input.split(" "); int n = Integer.parseInt(split[0]); int k = Integer.parseInt(split[1]); int[] dp = new int[k+1]; int[] coins = new int[n]; for (int i = 0; i < n; i++) { coins[i] = Integer.parseInt(br.readLine()); } dp[0] = 1; for (int i = 0; i < n; i++) { for (int j = 0; j <= k; j++) { if(j >= coins[i]) { dp[j] += dp[j - coins[i]]; } } } System.out.println(dp[k]); } }
Sorry, something went wrong.
CMSSKKK
No branches or pull requests
TITLE
동전1
LINK
📷 Screenshots
댓글 양식
The text was updated successfully, but these errors were encountered: