P1164 小A点菜

点击查看代码
#include<bits/stdc++.h>
using namespace std;

const int N=110,M=10010;
int f[M],w[N];
int n,m;

int main()
{
    ios::sync_with_stdio(0),cin.tie(0);
    cin>>n>>m;

    f[0]=1;

    for(int i=1;i<=n;i++) cin>>w[i];

    for(int i=1;i<=n;i++){
        for(int j=m;j>=w[i];j--){
            f[j]=f[j]+f[j-w[i]];
        }
    }

    cout<<f[m]<<endl;

    return 0;
}
posted @ 2026-02-02 21:00  AnoSky  阅读(1)  评论(0)    收藏  举报