HDU 1028 Ignatius and the Princess III(母函数整数拆分)
链接:传送门
题意:一个数n有多少种拆分方法
思路:典型母函数在整数拆分上的应用
/*************************************************************************
> File Name: 1.cpp
> Author: WArobot
> Blog: http://www.cnblogs.com/WArobot/
> Created Time: 2017年04月20日 星期四 21时07分09秒
************************************************************************/
#include<bits/stdc++.h>
using namespace std;
int p[130] , a[130] , b[130];
int n;
void init(){
for(int N = 1;N<=120;N++){
for(int i=0;i<=N;i++) a[i] = 1 , b[i] = 0;
for(int i=2;i<=N;i++){
for(int j=0;j<=N;j++)
for(int k=0;k*i+j<=N;k++) b[k*i+j] += a[j];
for(int j=0;j<=N;j++) a[j] = b[j] , b[j] = 0;
}
}
}
int main(){
init();
while(scanf("%d",&n)!=EOF && n){
printf("%d\n",a[n]);
}
return 0;
}
HDU 1028 Ignatius and the Princess III(母函数整数拆分)的更多相关文章
- hdu 1028 Ignatius and the Princess III 母函数
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- HDU 1028 Ignatius and the Princess III dp整数划分
http://acm.hdu.edu.cn/showproblem.php?pid=1028 dp[i][j]表示数值为i,然后最小拆分的那个数是j的时候的总和. 1 = 1 2 = 1 + 1 . ...
- hdu 1028 Ignatius and the Princess III 简单dp
题目链接:hdu 1028 Ignatius and the Princess III 题意:对于给定的n,问有多少种组成方式 思路:dp[i][j],i表示要求的数,j表示组成i的最大值,最后答案是 ...
- HDU 1028 Ignatius and the Princess III 整数的划分问题(打表或者记忆化搜索)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1028 Ignatius and the Princess III Time Limit: 2000/1 ...
- 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 ...
- 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 ...
- hdu 1028 Ignatius and the Princess III (n的划分)
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- HDU 1028 Ignatius and the Princess III (递归,dp)
以下引用部分全都来自:http://blog.csdn.net/ice_crazy/article/details/7478802 Ice—Crazy的专栏 分析: HDU 1028 摘: 本题的意 ...
- HDU 1028 Ignatius and the Princess III (生成函数/母函数)
题目链接:HDU 1028 Problem Description "Well, it seems the first problem is too easy. I will let you ...
随机推荐
- Guava 是个风火轮之基础工具 (1)
转自:http://www.jamespan.me/blog/2015/02/08/guava-basic-utilities-1/ Guava 是个风火轮之基础工具 (1) 前言 Guava 是 J ...
- Laravel的维护模式
1.开启维护模式: php artisan down 2.关闭维护模式:php artisan up 3.当应用处于维护模式时,所有的路由都会指向一个自定义的视图.这对于更新应用或执行维护任务时临时 ...
- 2016年工作中遇到的问题1-10:select-for-update锁表
1.select... for update锁表.注意事项:事务下使用,@Transactional如果用主键,只锁住1行记录如果不用主键,会锁住多条记录,mysql下测试,查询1条,锁住1行,查询2 ...
- sso 系统分析
一.什么是 sso 系统 SSO 英文全称 Single Sign On,单点登录.SSO 是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的应用系统.它包括可以将这次主要的登录映射到其他 ...
- tx:advice标签简介
http://book.51cto.com/art/200909/149437.htm
- HDU 4046 Panda(树状数组)
Panda Time Limit: 10000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- 【零基础入门学习Python笔记013】元祖:戴上了枷锁的列表
元组:戴上了枷锁的列表 因为和列表是近亲关系.所以元祖和列表在实际使用上是很相似的. 本节主要通过讨论元素和列表究竟有什么不同学习元祖. 元组是不可改变元素的.插入.删除或者排序都不能够.列表能够随意 ...
- java之 ------ 设计思想
java的设计思想 (设计思想.是须要不断领悟的.. . ) 一.封装 学java的人都知道这是向对象的编程语言,从字面上理解,就是针对对象的一些操作,将具有某一特性的实体封装成一个类或者是将具有一定 ...
- Hive权限之改进
不足 即使开启hive权限认证的情况下,不论什么用户仍然是超级用户.能够通过grant给不论什么人赋予不论什么权限,这样权限认证基本没有意义.因此必须在开启权限认证的同一时候.对运行grant/rev ...
- Linux3.5内核以后的路由下一跳缓存
在Linux3.5版本号(包括)之前.存在一个路由cache.这个路由cache的初衷是美好的,可是现实往往是令人遗憾的.下面是陈列得出的两个问题:1.面临针对hash算法的ddos问题(描写叙述该问 ...