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 ...
随机推荐
- VS2008集成QT的OpenGL开发(实现二维图形的旋转)
主要是利用Qt中的定时器实现了二维图形的旋转功能: #ifndef QGLTEST_H #define QGLTEST_H #include <QGLWidget> #include &l ...
- Project Euler 11 Largest product in a grid
题意:在这个20×20方阵中,四个在同一方向(从下至上.从上至下.从右至左.从左至右或者对角线)上相邻的数的乘积最大是多少? 思路:暴力去枚举以 ( x , y ) 为中心拓展的四个方向 /***** ...
- BZOJ 3876 [AHOI/JSOI2014]支线剧情 (最小费用可行流)
题面:洛谷传送门 BZOJ传送门 题目大意:给你一张有向无环图,边有边权,让我们用任意条从1号点开始的路径覆盖这张图,需要保证覆盖完成后图内所有边都被覆盖至少一次,求覆盖路径总长度的最小值 最小费用可 ...
- Spring MVC 的概念1
---恢复内容开始--- SpringMVC是一个采用模型----视图------控制器(MVC)的WEb框架建立在中央前端控制器的 Servlet(DispatcherServlet),他负责发送每 ...
- 用于检测进程的shell脚本
用于检测进程的shell脚本 2010-07-07 10:38:08| 分类: Centos |字号 订阅 脚本一: #!/bin/sh program=XXXX #进程名 sn=`ps - ...
- oracle schema彻底理解
oracle中的Schema简析 在一个数据库中可以有多个应用的数据表,这些不同应用的表可以放在不同的schema之中,同时,每一个schema对应一个用户,不同的应用可以以不同的用户连接数据库,这样 ...
- 经验总结21--抓取WEB数据,汇率,HtmlAgilityPack
网上找了非常多资料,PHP的比較多,然后找到有csv文件的.处理起来非常麻烦,国外的站点速度非常慢. 最后还是去页面上抓取数据,我是从中国银行抓取的,各位可去其它站点抓取. 1.模拟请求URL. st ...
- python的range()函数使用方法
python的range()函数使用非常方便.它能返回一系列连续添加的整数,它的工作方式类似于分片.能够生成一个列表对象. range函数大多数时常出如今for循环中.在for循环中可做为索引使用.事 ...
- 根据EXCEL模板填充数据
string OutFileName = typeName+"重点源达标率" + DateTime.Now.ToString("yyyy-MM-dd"); ...
- UESTC--1272--Final Pan's prime numbers(水题)
Final Pan's prime numbers Time Limit: 1000MS Memory Limit: 65535KB 64bit IO Format: %lld & % ...