HDU2152母函数
来源:互联网 发布:win7触摸屏校准软件 编辑:程序博客网 时间:2024/06/06 01:11
题目是汉语没什么难理解的地方,直接上代码:
如果大家对母函数还不够理解,可以尝试HDU1028
http://blog.csdn.net/gaokao_sijiao/article/details/62238041
那道题还是比较简单的。
题目链接
http://acm.hdu.edu.cn/showproblem.php?pid=1028
code:
(参看了http://blog.csdn.net/xiaofei_it/article/details/17042651,但是没搞明白第二种,还需努力)
#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#include<iostream>#include<string>#include <set>using namespace std;#define ll long long#define mem(a) memset(a,0,sizeof(a))const int eps=1e-8;const int maxn=210;//须填写const int inf=0x3f3f3f3f;int a[maxn];int b[maxn];int n1[maxn];int n2[maxn];int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { for(int i=0;i<n;i++) scanf("%d%d",&n1[i],&n2[i]); mem(a); a[0]=1; for(int i=0;i<n;i++) { mem(b); for(int j=n1[i];j<=m&&j<=n2[i];j++) for(int k=0;k+j<=m&&k<=m;k++) { b[k+j]+=a[k]; } memcpy(a,b,sizeof(b)); } printf("%d\n",a[m]); } return 0;}
0 0
- HDU2152 Fruit,母函数
- HDU2152 (母函数)
- hdu2152(母函数)
- HDU2152母函数
- Fruit(hdu2152,母函数)
- HDU2152 Fruit[母函数/背包]
- hdu2152(母函数入门)
- hdu2152
- hdu2152
- HDU_Steps7.3 母函数,组合 HDU2451 HDU1398 HDU2152 HDU1709 HDU1028 HDU3398 HDU2179
- hdu2152 Fruit
- hdu2152 Fruit (背包dp)
- 母函数
- 母函数
- 母函数
- 母函数
- 母函数
- 母函数
- HDFS性能测试及优化部署
- 空类所占内存的大小
- 嵌入式LINUX环境下视频采集知识(V4L2)
- dd
- 【GDOI2017模拟2.25】太空飞船
- HDU2152母函数
- http://blog.csdn.net/fjb2080/article/details/7969832
- MATLAB工具箱路径缓存
- TFTP&NFS 的配置
- 解决头文件定义变量的问题,巧用宏定义(续)
- 工厂模式
- IO流
- install hadoop in fedora
- linux 概念之pid tid区分