您的位置:首页 > 其它

51nod oj 1101 换零钱【完全背包】

2016-08-13 10:45 169 查看
传送门:1101

硬币无限多---完全背包

代码:

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
long long dp[100100],mod,ans;
int main()
{
int shu[14]={0,1,2,5,10,20,50,100,200,500,1000,2000,5000,10000};
int n;scanf("%d",&n);
mod=1000000007;
memset(dp,0,sizeof(dp));
dp[0]=1;
for (int i=1;i<=13;i++)
for (int j=shu[i];j<=n;j++)
dp[j]=(dp[j]+dp[j-shu[i]])%mod;
printf("%d\n",dp
);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: