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 ...
随机推荐
- [bzoj 2726] 任务安排 (斜率优化 线性dp)
3月14日第三题!!!(虽然是15号发的qwq) Description 机器上有N个需要处理的任务,它们构成了一个序列.这些任务被标号为1到N,因此序列的排列为1,2,3-N.这N个任务被分成若干批 ...
- Problem 8
Problem 8 # Problem_8.py """ The four adjacent digits in the 1000-digit number that h ...
- Python智能提示--提示对象内涵成员
1. demo展示 2. 提示效果
- FreeMarker 语法 访问 pojo 的属性
一.java 代码 @Test public void testFreeMarker() throws Exception { //1.创建一个模板文件 //2.创建一个Configuration对象 ...
- 基础框架整合-ssm框架+前后台交互完整教程
1.基本概念 ssm:spring+springMVC+mybatis 2.开发环境 Eclipse mars + jdk1.7 + maven + tomcat7 3.使用maven构建web项目 ...
- $_SERVER 详解
$_SERVER['HTTP_ACCEPT_LANGUAGE']//浏览器语言 $_SERVER['REMOTE_ADDR'] //当前用户 IP . $_SERVER['REMOTE_HOST'] ...
- LiquidCrystal库函数
主要资料来源: 极客工坊-知识库 (LiquidCrystal库地址:http://wiki.geek-workshop.com/doku.php?id=arduino:libraries:liqui ...
- CAD教程-AL对其命令
AL可以实现不规则的对其功能 1.第一步按下AL,按下Enter 2.选择第一个源点 3.选择第一个目标点 4.选择第二个源点 5.选择第二个目标点 6.按下Enter,完成移位
- Atom介绍和安装步骤
Atom是全然基于web技术开发而成的一款编辑器,其底层架构依赖于chromium,google chrome浏览器也是基于此.编辑器的每一个窗体都是本地渲染的web页面,而且其风格与时下流行的sub ...
- TS3
let [first, ...rest] = [1, 2, 3, 4]; console.log(first); // outputs 1 console.log(rest); // outputs ...