老是想着化简,实际上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. weexpack 的 Login.vue 及 vue 的 Login.vue

    1.登录页 weexpack  Login.vue <!-- 登录页 --> <template> <div class="wrapper"> ...

  2. Android使用procrank和dumpsys meminfo 、top分析内存占用情况

    如果你想查看所有进程的内存使用情况,可以使用命令procrank.dumpsys meminfo查看,当然也只可以过滤出某个进程如:dumpsys meminfo | grep -i phone 先来 ...

  3. 【转载】lvs为何不能完全替代DNS轮询

    上一篇文章"一分钟了解负载均衡的一切"引起了不少同学的关注,评论中大家争论的比较多的一个技术点是接入层负载均衡技术,部分同学持这样的观点: 1)nginx前端加入lvs和keepa ...

  4. android笔记5——同一个Activity中Fragment的切换

    今天来模拟一个注冊的界面过程: 点击"下一步"之后: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvZW5zb24xNjg1NQ==/f ...

  5. 【iOS开发系列】cell切割线置顶

    废话不多说,直接上代码: /** * tableViewCell切割线左側置顶 < 1 > */ -(void)viewDidLayoutSubviews { if ([_tableVie ...

  6. (转)C系程序员面试必知必会之大端小端

      C程序员经常被问及的一道面试题是:什么是大端/小端,怎么样判断是大端/小端?大端小端问题对于嵌入式程序员绝对不会陌生(否则,别告诉我你是搞嵌入式的),它与CPU体系结构有关.比如常见的X86处理器 ...

  7. mysql order by的一些技巧

    1. 只按日期排序,忽略年份> select date, description from table_name order by month(date),dayofmonth(date);注意 ...

  8. Arcgis Engine(ae)接口详解(6):workspace操作

    //此处用的workspace来源与用户选择 IWorkspace workspace = null; //workspace一般等同于数据库 //工作空间类型,也可理解为数据库类型 //esriFi ...

  9. pyspark 连 MongoDB复制集

    解决问题思路: 核心:0-理解pyspark的执行与java jar的关系: 1-看控制台,看日志: 2-jar缺不缺,版本号,放哪里. [root@hadoop1 mylocalRepository ...

  10. 今日头条上看到的js面试题和答案

    用js判断字符中每个字符出现的次数, 答案是var info = arr.split('').reduce((a,b)=>(console.log(a,b),a[b]++ || (a[b]=1) ...