hdu1028 Ignatius and the Princess III(生成函数整理占坑)upd 已咕
2018-05-20 18:06
399 查看
先咕着
---------------2018 5 22----------------------
---------------2018 5 22----------------------
题解
生成函数处理整数拆分code
#include<cstdio> #include<cstring> #include<algorithm> inline int raed() { int x = 0,f = 1; char c = getchar(); while(c < '0' || c < '9') c = getchar(); while(c <= '9' && c >= '0')x = x * 10 + c - '0',c = getchar(); return x * f; } const int maxn = 564; int a[maxn],b[maxn]; int main() { int n; while(scanf("%d",&n) == 1) { 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 + j <= 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 ); } return 0; }
相关文章推荐
- [省选前题目整理][HDU 1028]Ignatius and the Princess III(生成函数)
- HDU1028 Ignatius and the Princess III 【母函数模板题】
- hdu1028 Ignatius and the Princess III
- hdu1028 Ignatius and the Princess III 递推
- 【完全背包/母函数/递推】HDU1028-Ignatius and the Princess III
- HDU1028 Ignatius and the Princess III 【求一个整数被分为多个数相加有多少种可能】
- hdu1028 Ignatius and the Princess III (完全背包)
- hdu1028 Ignatius and the Princess III ——DP
- HDU1028 Ignatius and the Princess III 【母函数模板题】
- HDU1398-Square Coins,HDU1028-Ignatius and the Princess III(母函数)
- HDU1028 Ignatius and the Princess III【母函数】【完全背包】
- hdu1028 Ignatius and the Princess III && hdu2082 找单词 && poj1664 放苹果 && noj1046 正整数划分问题——整数划分
- HDU1028 Ignatius and the Princess III(dp)
- HDU1028:Ignatius and the Princess III(dp入门 & 母函数)
- hdu1028 Ignatius and the Princess III
- 【母函数】hdu1028 Ignatius and the Princess III
- HDU1028-Ignatius and the Princess III
- hdoj1028 Ignatius and the Princess III(母函数,生成函数)
- HDU1028 Ignatius and the Princess III(整数拆分:母函数||DP)
- hdu1028 Ignatius and the Princess III