老是想着化简,实际上O(n^3)就行了……

写成生成函数是\( \prod_{i=1}{n}(1+xi+2{2i}+...+x{ \left \lfloor \frac{n}{i} \right \rfloor }) \),暴力乘即可

#include<iostream>
#include<cstdio>
using namespace std;
const int N=125;
int n,a[N],b[N];
int main()
{
while(~scanf("%d",&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<=n;k+=i)
b[j+k]+=a[j];
for(int j=0;j<=n;j++)
a[j]=b[j],b[j]=0;
}
printf("%d\n",a[n]);
}
return 0;
}

hdu 1028 Ignatius and the Princess III【生成函数】的更多相关文章

  1. HDU 1028 Ignatius and the Princess III (生成函数/母函数)

    题目链接:HDU 1028 Problem Description "Well, it seems the first problem is too easy. I will let you ...

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

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

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

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

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

  6. hdu 1028 Ignatius and the Princess III 母函数

    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 (n的划分)

    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)

    以下引用部分全都来自:http://blog.csdn.net/ice_crazy/article/details/7478802  Ice—Crazy的专栏 分析: HDU 1028 摘: 本题的意 ...

  9. HDU 1028 Ignatius and the Princess III (动态规划)

    题目链接:HDU 1028 Problem Description "Well, it seems the first problem is too easy. I will let you ...

随机推荐

  1. Vue 开发线路 资料 汇总

    线路 作者推荐学习线路 https://zhuanlan.zhihu.com/p/23134551 他人建议 https://www.cnblogs.com/smartXiang/p/6051086. ...

  2. centos7 网络不能重启问题 解决办法

    cnetos7 网络不可重启 突然解决办法 参考他人处理 之前部署hadoop环境,在自己机器上安装了一台centos虚拟机,然后图省事,就克隆出三台,一台为master,另两台来作为 slave. ...

  3. vue2.0 常用的 UI 库

    1.mint-ui 安装: npm install mint-ui --save 使用: main.js // MintUI组件库 import MintUI from 'mint-ui' impor ...

  4. vim note (1)

    'vim' go into the vim mode 'i' 'a' 's'    is means insert mode 'v' is means visual mode 'esc' is mea ...

  5. Django-权限信息初始化

    数据库 from django.db import models class Menu(models.Model): """ 菜单组: """ ...

  6. 利用python暴力破解ssh

    # -*- coding:utf-8 -*- #python 2.7 import optparse,sys,threading import pexpect PROMPT = ['#','>' ...

  7. Apache Qpid Broker的安全机制

    一.     Apache Qpid的安全机制简介 Apache Qpid提供多种安全机制,包括用户认证.规则定制的授权.消息加密和数字签名等.Apache Qpid使用SASL框架实现对用户身份的认 ...

  8. Kafka知识点汇总

    整体结构 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZXJpY19zdW5haA==/font/5a6L5L2T/fontsize/400/fill/I ...

  9. Asp.net 两个链接实现虾米音乐搜索

    起因 暑假刚结束,又要回到学校写代码了,本人写代码的时候特别喜欢听歌,一直使用的是虾米音乐,出于好奇,想给自己的网站集成虾米音乐搜索功能,但是一直找不到虾米开放api,所以只能自己找办法了,之后发现一 ...

  10. nginx搭建支持http和rtmp协议的流媒体server之中的一个

    实验目的:让Nginx支持flv和mp4格式文件,支持RTMP协议的直播和点播:同一时候打开RTMP的HLS功能 ​资料:HTTP Live Streaming(缩写是 HLS)是一个由苹果公司提出的 ...