HDU - 1028

step 1:初始化第一个多项式 也就是 由 1的各种方案 组 成 的多项式 初始化系数为 1。临时区 temp初始化 为 0

step 2:遍历后续的n - 1 个 多项式 ,第二重 for  j  代 表 的 存 储 结 果 的 多 项 式的次数,k 代表 当前 第 i 的 多项式的次数

通过计算发现两个多项式相乘 其中一个 系数为1和 0 组成,运算时可以初始化系数数组为0 ,然后 由另一个的系数 与之相加即可得到

G(x)=(1+x+x2+x3+x4+.....)(1+x2+x4+x6+x8+......)(1+x3+x6+x9+....)........(1+xn)

#include<bits/stdc++.h>
using namespace std;
#define maxn 234
int ans[maxn],tp[maxn],n;
int main()
{
while(~scanf("%d",&n))
{
for(int i=0; i<=n; i++)
ans[i]=1,tp[i]=0;
for(int i=2; i<=n; i++)
{
for(int j=0; j<=n; j++)
for(int k=0; k+j<=n; k+=i)
tp[j+k]+=ans[j];
for(int j=0; j<=n; j++)
ans[j]=tp[j],tp[j]=0;
}
printf("%d\n",ans[n]);
}
return 0;
}

  

Ignatius and the Princess III HDU - 1028 -生成函数or完全背包计数的更多相关文章

  1. Ignatius and the Princess III HDU - 1028 || 整数拆分,母函数

    Ignatius and the Princess III HDU - 1028 整数划分问题 假的dp(复杂度不对) #include<cstdio> #include<cstri ...

  2. Ignatius and the Princess III HDU - 1028

    题目传送门:https://vjudge.net/problem/HDU-1028 思路:整数拆分构造母函数的模板题 1 //#include<bits/stdc++.h> 2 #incl ...

  3. 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 ...

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

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

  5. 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 ...

  6. 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 ...

  7. HDU 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 母函数

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

随机推荐

  1. 【Vue】组件watch props属性值

    转载: https://www.cnblogs.com/mqxs/p/8972368.html #HTML <div id="example"> <p> & ...

  2. Python GUI界面编程

    常用GUI框架 wxPython 安装wxPython pip install -U wxPython C:\Users> pip install -U wxPython Collecting ...

  3. 理解并设计rest/restful风格接口

    网络应用程序,分为前端和后端两个部分.当前的发展趋势,就是前端设备层出不穷(手机.平板.桌面电脑.其他专用设备......). 因此,必须有一种统一的机制,方便不同的前端设备与后端进行通信.这导致AP ...

  4. vue-cli watch简单用法

    创建一个vue单文件 <template> <div id="test"> <h4 @click="changeMsg()" id ...

  5. 论文阅读笔记三十九:Accurate Single Stage Detector Using Recurrent Rolling Convolution(RRC CVPR2017)

    论文源址:https://arxiv.org/abs/1704.05776 开源代码:https://github.com/xiaohaoChen/rrc_detection 摘要 大多数目标检测及定 ...

  6. Redis都有哪些数据类型

    string 这是最基本的类型了,就是普通的set和get,做简单的kv缓存 hash 这个是类似map的一种结构,这个一般就是可以将结构化的数据,比如一个对象(前提是这个对象没嵌套其他的对象)给缓存 ...

  7. expdp、impdp 使用sys用户操作时的注意事项

    https://blog.csdn.net/ctypyb2002/article/details/78420711

  8. Doracle.jdbc.J2EE13Compliant=true

    To make the Oracle driver behave in a Java EE-compliant manner, you must define the following JVM pr ...

  9. spring security实现动态配置url权限的两种方法

    缘起 标准的RABC, 权限需要支持动态配置,spring security默认是在代码里约定好权限,真实的业务场景通常需要可以支持动态配置角色访问权限,即在运行时去配置url对应的访问角色. 基于s ...

  10. 【Android】Android 代码判断是否获取ROOT权限(一)

    [Android]Android 代码判断是否获取ROOT权限 方法比较简单,直接粘贴代码 public synchronized boolean getRootAhth() { Process pr ...