hdoj1028 Ignatius and the Princess III(母函数,生成函数)
来源:互联网 发布:.erm如何生成数据库表 编辑:程序博客网 时间:2024/06/15 23:37
硬想了大半天还是不会。一开始想找规律看看有没有什么递推式,无果。。。
后面在网上看代码,了解到有关母函数的问题。
大神帅气闪闪的讲解入口http://blog.csdn.net/vsooda/article/details/7975485(母函数详细讲解)
在这里列个本题解法和母函数的模板。
#include<string.h>
#include<stdio.h> int main() { int i,j,k,n,c1[125],c2[125]; while(scanf("%d",&n)!=EOF) { memset(c2,0,sizeof(c2)); for(i=0; i<=n; i++) c1[i]=1; for(i=2; i<=n; i++) { for(j=0; j<=n; j++) { for(k=0; j+k<=n; k+=i) { c2[j+k]+=c1[j]; } } for(j=0; j<=n; j++) { c1[j]=c2[j]; c2[j]=0; } } printf("%d\n",c1[n]); } return 0; }
阅读全文
0 0
- hdoj1028 Ignatius and the Princess III(母函数,生成函数)
- 母函数之Ignatius and the Princess III hdoj1028
- hdoj1028 Ignatius and the Princess III (母函数-整数拆分)
- HDOJ1028 Ignatius and the Princess III
- hdoj1028 Ignatius and the Princess III(整数分解)
- hdu 1028 Ignatius and the Princess III(生成函数)
- HDU 1028 Ignatius and the Princess III 生成函数(母函数)
- HDU 1028 Ignatius and the Princess III(母函数)
- HDU 1028 Ignatius and the Princess III (母函数)
- HDU-1028Ignatius and the Princess III(母函数)
- hdu 1028 Ignatius and the Princess III(母函数)
- hdu1028-Ignatius and the Princess III (母函数模板)
- [hdu 1028] Ignatius and the Princess III (母函数)
- hdu 1028 Ignatius and the Princess III ( 母函数)
- HDU1028 Ignatius and the Princess III(母函数)
- HDU1028 Ignatius and the Princess III(母函数模板)
- HDU -- 1028 Ignatius and the Princess III(母函数)
- 【母函数】hdu1028(Ignatius and the Princess III)
- 一个简单的viewpager适配器
- PHP 静态方法、静态属性
- Threding
- shiro第二天 shiro授权 shiro和企业项目整合开发
- iOS 知识点归纳- 持续更新
- hdoj1028 Ignatius and the Princess III(母函数,生成函数)
- 学术论文你该怎么写
- POJ 1375 Intervals 笔记
- HDU
- java开发者的福音, 功能齐全的Integer类
- 我有问题-Qt篇(1)
- android_apktool工具的使用
- android Retrofit简单使用及源码分析
- 二叉搜索树(Binary Search Trees)小结