delete pics to save space
This commit is contained in:
21
history_source/信息学奥赛一本通/2.9.3.3.cpp
Normal file
21
history_source/信息学奥赛一本通/2.9.3.3.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include<cstdio>
|
||||
#include<algorithm>
|
||||
using namespace std;
|
||||
int n,k,a[110][110],num;
|
||||
int main()
|
||||
{
|
||||
scanf("%d%d",&n,&k);
|
||||
for(int i=1;i<=n;i++)
|
||||
{
|
||||
scanf("%d",&num);
|
||||
a[i][num%k]=num;
|
||||
for(int j=0;j<k;j++)
|
||||
{
|
||||
if(a[i-1][j])
|
||||
a[i][(j+num)%k]=a[i-1][j]+num;//ȡ
|
||||
a[i][j]=max(a[i][j],a[i-1][j]);//<2F><>ȡ
|
||||
}
|
||||
}
|
||||
printf("%d\n",a[n][0]);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user