提交时间:2023-12-16 08:35:26
运行 ID: 116123
# include <bits/stdc++.h> using namespace std ; int num [114514] , dp [114514] = { 1 } , c , a ; int main ( ) { cin >> c >> a ; for ( int i = 1 ; i <= c ; i ++ ) { cin >> num [i] ; } for ( int i = 1 ; i <= a ; i ++ ) { for ( int j = 1 ; j <= c ; j ++ ) { if ( i - num [j] >= 0 ) { dp [i] += dp [i - num [j]] ; } } } cout << dp [a] << endl ; return 0 ; }