简介
经典背包模型
import java.util.*;
class Main{
static int N = 10010;
static int M = 3;
static int n;
static int m;
static int[] a= new int[N];
static long res=0;
static long[] f = new long[N];
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
n =sc.nextInt();
m =sc.nextInt();
f[0] = 1;
for(int i=1;i<= n;i++){
int v = sc.nextInt();
for(int j =v;j<= m;j++){
f[j] = f[j] + f[j-v];
}
}
System.out.println(f[m]);
}
}