样例不过?
查看原帖
样例不过?
928895
NOBenRen楼主2024/8/1 10:31
#include <bits/stdc++.h>
using namespace std;
const int m=1e8;
int n,f,w[2005];
long long a[2005][1005];
int main(){
	cin>>n>>f;
	for(int i=1;i<=n;i++)cin>>w[i],w[i]%=f,a[i][w[i]]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<f;j++)
			a[i][j]=((a[i][j]+a[i-1][j])%m+a[i-1][j-w[i]+f]%f)%m;
	cout<<a[n][0];
	return 0;
}

样例过不了。。。 悬关

2024/8/1 10:31
加载中...