// M as knapsack capacity, as a number to each item, as is the volume Ai @ objectives: seeking a total volume of exactly the number of programs M #include <the iostream> the using namespace STD; const int N = 10010 ; int n-, m; int F [N]; // F [i] [j] denotes the i-th former species selected from the items, and the number of program bits j // then [i] to optimize this layer away, int main ( ) { CIN >> >> n- m; F [ 0 ] = . 1 ; for ( int I = 0 ; I <n-; I ++ ) { int V; CIN >> V; for ( int J = m; J> = V; J - ) F [J] = F [J] + F [J - V]; // divided into two cases: the i-th selected and not selected the i a } COUT << F [m] << endl; return 0 ; }