HDU-1176 免费馅饼
来源:互联网 发布:淘宝证件相片拍摄 编辑:程序博客网 时间:2024/05/20 21:49
这道题的思想前辈,已经讲过了。代码当然是根据前辈的思想写的。
AC代码:
#include<iostream>#include<cstdio>#include<cstring>using namespace std;int number[13][100010];int n,x,t,max_t,max_x,max_three;void DP(){ for(int j = max_t - 1; j >= 0 ; j--) for(int i = 1; i <= max_x; i++) { max_three = number[i - 1][j + 1]; if(max_three < number[i][j + 1]) max_three = number[i][j + 1]; if(max_three < number[i + 1][j + 1]) max_three = number[i + 1][j + 1]; number[i][j] += max_three; } printf("%d\n",number[6][0]);}int main(){ while(scanf("%d",&n)) { if(n == 0) break; memset(number,0,sizeof(number)); max_t = max_x = 0; for(int i = 0; i < n; i++) { scanf("%d %d",&x,&t); number[++x][t]++; if(t > max_t) max_t = t; if(x > max_x) max_x = x; } DP(); } return 0;}
END
0 0
- hdu 1176 免费馅饼
- hdu 1176 免费馅饼
- hdu 1176 免费馅饼
- HDU 1176 - 免费馅饼
- hdu 1176 免费馅饼
- hdu 1176免费馅饼
- hdu 1176 免费馅饼
- HDU 1176 免费馅饼
- hdu 1176 免费馅饼
- HDU 1176 免费馅饼
- hdu 1176 免费馅饼
- hdu - 1176 - 免费馅饼
- HDU 1176 免费馅饼
- HDU 1176 免费馅饼
- hdu 1176 免费馅饼
- HDU 1176 免费馅饼
- 免费馅饼 hdu 1176
- hdu 1176 免费馅饼
- Android反编译操作详解
- 领军杰出青年高燃二次创业
- 我
- NonUniqueObjectException: a different object with the same identifier va lue was already associated
- 操作系统面试题(三)
- HDU-1176 免费馅饼
- ioremap
- GridView 动态绑定列
- 跟我一起学Makefile
- ASIHTTPRequest系列(四):Cookies
- Javascript:继承和原型链
- 杜拉斯和她的情人
- zImage内核镜像解压过程详解
- expect中使用exec执行shell命令的方法