hdu 1028 母函数模板
来源:互联网 发布:json文件中文乱码 编辑:程序博客网 时间:2024/06/06 01:52
#include <iostream>#include <cstring>#define mem(x, k) ((x), (k), sizeof(x))#define M 130using namespace std;int g[M], G[M];int main(){int n;while (~scanf("%d", &n)){memset mem(g, 0);memset mem(G, 0);G[0] = 1;for (int i=1;i<=n;++i){for (int j=0;j<=n;++j)for (int k=0;k+j<=n;k+=i){g[j+k] += G[j];}memcpy mem(G, g);memset mem(g, 0);}printf("%d\n", G[n]);}return 0;}
附:完全背包;
#include<stdio.h>#include<string.h>int dp[200];int main(){int i,j;int n;while(scanf("%d",&n)!=EOF){memset(dp,0,sizeof(dp));dp[0]=1;for(i=1;i<=n;i++)for(j=i;j<=n;j++)dp[j]+=dp[j-i];printf("%d\n",dp[n]);}return 0;}
- hdu 1028 母函数模板
- 母函数模板 HDU-1028
- 母函数模板 hdu 2082
- hdu 2082 母函数模板
- hdu 1398 母函数模板
- HDU 1028 整数拆分 (母函数_模板|| 背包)
- hdu 2082(找单词)(母函数,模板)
- HDU 1085母函数模板题
- HDU 2082 母函数模板题
- HDU 2152 Fruit (母函数+模板)
- HDU 1536 SG函数模板
- (简单母函数模板)hdu 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III(母函数模板)
- HDU 1028 Ignatius and the Princess III (母函数模板)
- HDU1171 Big Event in HDU,母函数,终极模板
- 一道母函数的模板题 (hdu 2082)
- hdu 2082 母函数模板的基本运用
- HDU 1398 Square Coins(母函数模板题)
- Input 子系统
- webview中图片加载,添加放大缩小功能
- 数据搬运工-VB中参数(ByVal,ByRef)的传递
- HashMap的遍历键值
- Android 的 CPU
- hdu 1028 母函数模板
- 在Windows7 64位和VS2008环境下,PrintDialog.ShowDialog不能显示打印对话框
- 基于树的索引结构介绍
- 高效能屌丝创业者的七项习惯
- PHP伪造user_agent的方法
- java调用shell命令并获取执行结果
- 代码问题的总结
- JQuery操作 text,select,textarea,radio,checkbox
- 最近的生活