这是道典型的母函数的题目,可以看看我的母函数这一标签上的另一道例题,里面对母函数做了较为详细的总结。这题仅贴上代码:

#include"iostream"
using namespace std;
#define N 130
int a[N+],b[N+];
int main()
{
int n,i,j,k;
while(cin>>n&&n!=)
{
for(i=;i<=n;i++)
{a[i]=;b[i]=;}
for(i=;i<=n;i++)
{
for(j=;j<=n;j++)
for(k=;k+j<=n;k+=i)
{
b[k+j]+=a[j];
}
for(j=;j<=n;j++)
{
a[j]=b[j];b[j]=;
}
}
cout<<a[n]<<endl;
}
return ; }

hdu1028 Ignatius and the Princess III的更多相关文章

  1. HDU1028 Ignatius and the Princess III 【母函数模板题】

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  2. hdu1028 Ignatius and the Princess III(递归、DP)

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  3. HDU-1028 Ignatius and the Princess III(生成函数)

    题意 给出$n$,问用$1$到$n$的数字问能构成$n$的方案数 思路 生成函数基础题,$x^{n}$的系数即答案. 代码 #include <bits/stdc++.h> #define ...

  4. hdu1028 Ignatius and the Princess III(生成函数整理占坑)upd 已咕

    先咕着 ---------------2018 5 22---------------------- 题解 生成函数处理整数拆分 code #include<cstdio> #includ ...

  5. 【母函数】hdu1028 Ignatius and the Princess III

    大意是给你1个整数n,问你能拆成多少种正整数组合.比如4有5种: 4 = 4;  4 = 3 + 1;  4 = 2 + 2;  4 = 2 + 1 + 1;  4 = 1 + 1 + 1 + 1; ...

  6. ACM学习历程—HDU1028 Ignatius and the Princess III(递推 || 母函数)

    Description "Well, it seems the first problem is too easy. I will let you know how foolish you ...

  7. hdu acm 1028 数字拆分Ignatius and the Princess III

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  8. hdu 1028 Ignatius and the Princess III(DP)

    Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K ...

  9. hdu 1028 Ignatius and the Princess III 简单dp

    题目链接:hdu 1028 Ignatius and the Princess III 题意:对于给定的n,问有多少种组成方式 思路:dp[i][j],i表示要求的数,j表示组成i的最大值,最后答案是 ...

随机推荐

  1. Android 向Application对象添加Activity监听

    可以建立对象把Application.ActivityLifecycleCallbacks接口中的函数实现,并利用public void registerActivityLifecycleCallba ...

  2. 7.python模块补充

    此文章是对上节文章模块的补充 一,xml模块 xml是实现不同语言或程序之间进行数据交换的协议,可扩展标记语言,标准通用标记语言的子集,是一种用于标记电子文件使其具有结构性的标记语言.xml的格式如下 ...

  3. Java跨平台原理

    此篇博文主要源自网络xiaozhen的天空的博客:http://xiaozhen1900.blog.163.com/blog/static/1741732572011325111945246/ 1.是 ...

  4. 给mysql数据库插入当前时间

    mysql相关的三个函数有: NOW()函数以`'YYYY-MM-DD HH:MM:SS'返回当前的日期时间,可以直接存到DATETIME字段中.CURDATE()以’YYYY-MM-DD’的格式返回 ...

  5. [小细节,大BUG]记录一些小问题引起的大BUG(长期更新....)

    [小细节,大BUG] 6.问题描述:当从Plist文件加载数据,放入到tableView中展示时,有时有数据,有时又没有数据.这是为什么呢?相信很多大牛都想到了:我们一般将加载的数据,转换成模型,放入 ...

  6. git merge和个git rebase的区别

    http://stackoverflow.com/questions/16666089/whats-the-difference-between-git-merge-and-git-rebase/16 ...

  7. Base Filtering Engine 拒绝访问解法

    基本筛选引擎(BFE)是一种管理防火墙和 Internet 协议安全(IPsec)策略以及实施用户模式筛选的服务.停止或禁用 BFE 服务将大大降低系统的安全.还将造成 IPsec 管理和防火墙应用程 ...

  8. Linux底下的第一个C程序

    首先保证你的Linux底下安装了GCC,假如没有安装GCC的话请参考: http://www.cnblogs.com/aspirant/p/3544398.html 假如输入 gcc -v 不再是co ...

  9. Linux设置IP

    进入 vi /etc/sysconfig/network-scripts/ifcfg-eth0  root # ifconfig eth0 192.168.22.232 root # route ad ...

  10. CocoaPods报错及解决方法记录

    [!] Oh no, an error occurred. Search for existing GitHub issues similar to yours: https://github.com ...