[Aimee](https://www.luogu.com.cn/problem/P1474)

显然是个背包

#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
int n,v;
int f[100001];
int znx[1000001];
signed main(){
	scanf("%d%d",&n,&v);
	for(int i=1;i<=n;++i)
		scanf("%d",&znx[i]);
	f[0]=1;
	for(int j=1;j<=n;++j)	{
		for(int i=1;i<=v;++i){
			if(znx[j]<=i){
				f[i]+=f[i-znx[j]];
			}
		} 
	//	cout<<f[i]<<" ";
	}
	cout<<f[v];
	return 0;
}

相关文章:

  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-12-02
猜你喜欢
  • 2021-06-15
  • 2022-12-23
  • 2021-10-18
  • 2021-05-24
  • 2021-10-17
  • 2021-07-28
相关资源
相似解决方案