hdu1176 免费馅饼(塔形)
来源:互联网 发布:如何面试淘宝运营 编辑:程序博客网 时间:2024/06/09 19:37
http://acm.hdu.edu.cn/showproblem.php?pid=1176
#include<iostream>#include<iomanip>using namespace std;int s[100003][11],n,sum;int Max(int a,int b,int c){ if(a<b)a=b; if(a<c)a=c; return a;}void dp(){ int i,j; for(i=sum;i>0;i--) { for(j=0;j<=10;j++) { if(j==0)s[i-1][j]+=Max(0,s[i][j],s[i][j+1]); else if(j==10)s[i-1][j]+=Max(s[i][j-1],s[i][j],0); else s[i-1][j]+=Max(s[i][j-1],s[i][j],s[i][j+1]); } } printf("%d\n",s[0][5]);}int main(){ int i,a,b; while(scanf("%d",&n)) { sum=0; if(n==0)break; fill(&s[0][0],&s[100002][11]+1,0); for(i=0;i<n;i++) { scanf("%d%d",&a,&b); s[b][a]++; if(sum<b)sum=b; } dp(); } return 0;}
0 0
- hdu1176 免费馅饼(塔形)
- hdu1176免费馅饼(dp)
- hdu1176 免费馅饼(dp)
- hdu1176免费馅饼(动态规划)
- hdu1176免费馅饼(数塔)
- hdu1176 免费馅饼 (动态规划)
- hdu1176 免费馅饼(简单DP)
- hdu1176免费馅饼·(类数塔问题)
- HDU1176 免费馅饼(水DP)
- HDU1176免费馅饼(dp数塔)
- hdu1176 免费馅饼(数塔 dp)
- hdu1176 免费馅饼(变形数塔)
- hdu1176—免费馅饼(dp)
- 【HDU1176】免费馅饼(动态规划)
- HDU1176免费馅饼
- HDU1176 免费馅饼
- hdu1176免费馅饼
- HDU1176 免费馅饼
- 单件模式(Singleton)
- 【技术】【转】字节序问题--大端法小端法
- Windows、Ubuntu双系统重装windows系统后grub引导的修复及默认启动项的修改
- c/c++测量程序运行时间
- u-boot-2011.06在基于s3c2440开发板的移植之引导内核与加载根文件系统
- hdu1176 免费馅饼(塔形)
- 2014百度之星资格赛
- 使用openstack的虚拟机模版注意事项
- 图铭Android平台银行卡号识别系统
- 《Pro Android Graphics》读书笔记之第三节
- javaEE 部署Servlet文件的步骤
- CSS3主要知识点复习总结+HTML5新增标签
- C++创建动态数组
- 组合模式