ALGORITHM/BAEKJOON [BAEKJOON] 9084 동전 l_j_yeon 2017. 10. 4. 04:16 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int for_count; scanf("%d", &for_count); while (for_count--) { int n,money; scanf("%d", &n); vector<int>DP(10001, 0), coin(10001); for (int j = 0; j < n; j++) scanf("%d", &coin[j]); scanf("%d", &money); for (int j = 0; j < n; j++) { DP[coin[j]]++; for (int k = 1; coin[j] + k <= money; k++) DP[coin[j] + k] += DP[k]; } printf("%d\n", DP[money]); } return 0; } 저작자표시 비영리 변경금지 (새창열림)