#include <iostream>
using namespace std;
int N, M;
int Arr[21];
int DP[10001];
int main(){
int T;
cin >> T;
while(T--){
for(int i=0; i<10001; i++){
DP[i] = 0;
}
cin >> N;
for(int i=0; i<N; i++){
cin >> Arr[i];
}
cin >> M;
DP[0] = 1;
for(int i=0; i<N; i++){
for(int j=Arr[i]; j<=M; j++){
DP[j] += DP[j - Arr[i]];
}
}
cout << DP[M] << "\n";
}
return 0;
}
'알고리즘' 카테고리의 다른 글
[알고리즘] 프로그래머스 - 가장 많이 받은 선물 (0) | 2024.07.07 |
---|---|
[알고리즘] 백준 16507 - 어두운 건 무서워 (0) | 2024.07.06 |
[알고리즘] 백준 7579 - 앱 (0) | 2024.07.05 |
[알고리즘] 백준 16493 - 최대 페이지 수 (0) | 2024.07.03 |
[알고리즘] 백준 12865 - 평범한 배낭 (0) | 2024.07.01 |