hdu1028 Ignatius and the Princess III
这是道典型的母函数的题目,可以看看我的母函数这一标签上的另一道例题,里面对母函数做了较为详细的总结。这题仅贴上代码:
#include"iostream"
using namespace std;
#define N 130
int a[N+],b[N+];
int main()
{
int n,i,j,k;
while(cin>>n&&n!=)
{
for(i=;i<=n;i++)
{a[i]=;b[i]=;}
for(i=;i<=n;i++)
{
for(j=;j<=n;j++)
for(k=;k+j<=n;k+=i)
{
b[k+j]+=a[j];
}
for(j=;j<=n;j++)
{
a[j]=b[j];b[j]=;
}
}
cout<<a[n]<<endl;
}
return ; }
hdu1028 Ignatius and the Princess III的更多相关文章
- HDU1028 Ignatius and the Princess III 【母函数模板题】
Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K ...
- hdu1028 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$,问用$1$到$n$的数字问能构成$n$的方案数 思路 生成函数基础题,$x^{n}$的系数即答案. 代码 #include <bits/stdc++.h> #define ...
- hdu1028 Ignatius and the Princess III(生成函数整理占坑)upd 已咕
先咕着 ---------------2018 5 22---------------------- 题解 生成函数处理整数拆分 code #include<cstdio> #includ ...
- 【母函数】hdu1028 Ignatius and the Princess III
大意是给你1个整数n,问你能拆成多少种正整数组合.比如4有5种: 4 = 4; 4 = 3 + 1; 4 = 2 + 2; 4 = 2 + 1 + 1; 4 = 1 + 1 + 1 + 1; ...
- ACM学习历程—HDU1028 Ignatius and the Princess III(递推 || 母函数)
Description "Well, it seems the first problem is too easy. I will let you know how foolish you ...
- 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 ...
- 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
题目链接:hdu 1028 Ignatius and the Princess III 题意:对于给定的n,问有多少种组成方式 思路:dp[i][j],i表示要求的数,j表示组成i的最大值,最后答案是 ...
随机推荐
- TypeError: document.formname.submit is not a function
<form name="formname" ...> .... <input name="submit" type="submit& ...
- c++ const总结
[本文链接] http://www.cnblogs.com/hellogiser/p/cplusplus-const-summay.html 看到const 关键字,C++程序员首先想到的可能是con ...
- visual studio的项目属性表
最近发现一个有趣的东西:visual studio的项目属性表 我下载了cocos2d-x-3.0alpha1,然后发现HelloLua项目配置里没有配include搜索目录和依赖库以及一个Marco ...
- BestCoder12 1002.Help him(hdu 5059) 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5059 题目意思:就是输入一行不多于 100 的字符串(除了'\n' 和 '\r' 的任意字符),问是否 ...
- HDU5072 容斥原理
G - Coprime Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit ...
- hungary
更正:模数1000000007 /* 最大匹配求p=1的情况能得30分 正解:树形DP,f[i][0/1]表示i节点向下连的那条边选或不选时的最大值 */ #include<iostream&g ...
- commons-fileupload实现文件上传下载
commons-fileupload是Apache提供的一个实现文件上传下载的简单,有效途径,需要commons-io包的支持,本文是一个简单的示例 上传页面,注意设置响应头 <body> ...
- struts2 标签问题----escape="false" 这个属性
1.在编程过程中,会遇到这个动西,escape="false" eg: <s:fielderror escape="false"/>-------& ...
- rsync 不能同不子级目录的问题
/usr/bin/rsync -vr /alidata/www/pro/mobile/* /alidata/www/crontal/mobile #-r, --recursive 对子目录以递归模式处 ...
- C#.NET ObjectDumper
demo: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Sy ...