杭电OJ 1028:Ignatius and the Princess III
来源:互联网 发布:javaajax请求json数据 编辑:程序博客网 时间:2024/06/04 18:42
这是一个使用母函数的题目,之前听说过母函数,但是没有用过,后来查了一下资料,大概了解了一下,关于母函数的具体信息请参考:http://blog.csdn.net/lishuhuakai/article/details/8044431和http://www.matrix67.com/blog/archives/120两篇文章。
C++代码:
#include"iostream" using namespace std; #define N 130 int a[N+1],b[N+1]; int main(){ int n,i,j,k; while(cin>>n&&n!=0) { for(i=0;i<=n;i++) {a[i]=1;b[i]=0;} for(i=2;i<=n;i++) { for(j=0;j<=n;j++) for(k=0;k+j<=n;k+=i) { b[k+j]+=a[j]; } for(j=0;j<=n;j++) { a[j]=b[j];b[j]=0; } } cout<<a[n]<<endl; } return 0; }
0 0
- 杭电OJ 1028:Ignatius and the Princess III
- 【杭电oj】1028 - Ignatius and the Princess III(母函数打表)
- 杭电ACM OJ 1028 Ignatius and the Princess III 母函数+优化
- acm 杭电 ignatius and the princess iii 1028
- 杭电 ACM 1028 Ignatius and the Princess III
- 杭电 HDU ACM 1028 Ignatius and the Princess III
- 杭电OJ 1029:Ignatius and the Princess IV
- 杭电OJ 1027:Ignatius and the Princess II
- 杭电OJ 1026:Ignatius and the Princess I
- 杭电hdu 1028 Ignatius and the Princess III母函数
- 杭电ACM 1028 Ignatius and the Princess III(纯母函数模板)
- 杭电1028 Ignatius and the Princess III(母函数)
- Ignatius and the Princess III(杭电1028)(母函数)
- 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- HDOJ 1028:Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- libnids api
- poj1065
- 记录-数据结构第一章上机练习题
- Ural1042(高斯消元+枚举自由变元)
- 第二章 数据类型、运算符和表达式学习要求和实验
- 杭电OJ 1028:Ignatius and the Princess III
- [Hexo]使用Hexo(博客)+Gitcafe(服务器)+QiNiu(图床)搭建个人博客
- as3实现电脑关机
- 错误修改fstab后如何修复
- 提高网站关键词排名的技巧
- zoj 3765 Lights(Splay)
- 开户与查询
- FireFox 下selected = 'selected' 失效的解决方法
- 如何避免网站改版时候导致网站降权排名下降