8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4c036c commit 337006dCopy full SHA for 337006d
Appendix E/9084.cpp
@@ -0,0 +1,32 @@
1
+// http://boj.kr/d50d4f41d3364267bbc1c4bd5821a11d
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+
5
+int t, n, m;
6
+int coin[22];
7
+int d[22][10002];
8
9
+int main(void) {
10
+ ios::sync_with_stdio(0);
11
+ cin.tie(0);
12
13
+ cin >> t;
14
+ while(t--){
15
+ cin >> n;
16
+ for(int i = 0; i < n; i++){
17
+ cin >> coin[i];
18
+ d[i][0] = 1;
19
+ }
20
+ cin >> m;
21
22
+ for(int j = 1; j <= m; j++){
23
+ d[i][j] = 0;
24
+ if(i-1 >= 0)
25
+ d[i][j] += d[i-1][j];
26
+ if(j-coin[i] >= 0)
27
+ d[i][j] += d[i][j-coin[i]];
28
29
30
+ cout << d[n-1][m] << '\n';
31
32
+}
0 commit comments