hdu 1284 完全背包

http://acm.hdu.edu.cn/showproblem.php?pid=1284

Problem Description
在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。
 
Input
每行只有一个正整数N,N小于32768。
 
Output
对应每个输入,输出兑换方法数。
 
Sample Input
2934 12553
 
Sample Output
718831 13137761
 
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
int f[35000];
int main()
{
    int n,i,j,k;
        f[0]=1;
        for(i=1;i<=3;++i)
           for(j=i;j<35000;++j)
               f[j]+=f[j-i];
        while(cin>>n)
        printf("%d
",f[n]);

}

权威解释http://blog.sina.com.cn/s/blog_91e2390c01014b1u.html

差距还很大,代码要百度,不知道什么时候才能提高水平,做一个大牛级的人物!

原文地址:https://www.cnblogs.com/ccccnzb/p/3377751.html