Created
November 25, 2016 15:44
-
-
Save Hunachi/4fcd9c2bc680a481062d90a4bc611542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This Code is explode memories & times.
problem : JOI 2008 Darts. //AOJ 0529 problem.