Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include<iostream>
/**省略**/
int n,m;///制限
int dp[1000000001],d[1002];
/**省略**/
int main(){
dp[0]=1;
rep(i,0,n){
repm(j,10000001,0){
if(dp[j]){
if(dp[d[i]+j]){
dp[d[i]+j]=min(dp[j]+1,dp[d[i]+j]);
}else{
dp[d[i]+j]=dp[j]+1;
}
}
}
}
int ans = 0;
rep(i,0,m+1){
///1からだから5
if(dp[i]>0&&dp[i]<=5){
ans=i;
}
}
cout << ans << endl;
}
@Hunachi

This comment has been minimized.

Copy link
Owner Author

commented Nov 25, 2016

This Code is explode memories & times.
problem : JOI 2008 Darts. //AOJ 0529 problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.