HDU1176 免费馅饼
来源:互联网 发布:仿真类软件 编辑:程序博客网 时间:2024/06/10 03:14
#include <stdio.h>
#include <string.h>
int DP[100003][11];
int max(int a,int b,int c)
{
int m ;
m=a ;
m=b>m?b:m ;
m=c>m?c:m ;
return m ;
}
int main()
{
int i,j,n,t,sum,x ;
while(scanf("%d",&n)&&n)
{
sum=0 ;
memset(DP,0,sizeof(DP));
while(n--)
{
scanf("%d%d",&x,&t);
DP[t][x]++;
if(sum<t)
sum=t ; //sum record the longest time of this test
}
for(i=sum-1;i>=0;i--)
{ //注意这边从sum-1开始是因为下面会有i+1(就是sum了的)
//还有这边从大的开始而不是从(0,5)的起始点开始时因为并不知道最后会是在哪个位置
//所以就倒着推了的
DP[i][0]+=max(0,DP[i+1][0],DP[i+1][1]);
for(j=1;j<10;j++) //i represent the time , j represent the place(1~9)
DP[i][j]+=max(DP[i+1][j-1],DP[i+1][j],DP[i+1][j+1]);
DP[i][10]+=max(DP[i+1][9],DP[i+1][10],0);
}
printf("%d/n",DP[0][5]);
}
return 0;
}
- HDU1176免费馅饼
- HDU1176 免费馅饼
- hdu1176免费馅饼
- HDU1176 免费馅饼
- hdu1176免费馅饼
- hdu1176 免费馅饼
- HDU1176--免费馅饼
- hdu1176-免费馅饼
- hdu1176 免费馅饼
- HDU1176 免费馅饼
- hdu1176 免费馅饼
- hdu1176 免费馅饼
- hdu1176免费馅饼 dp
- HDU1176:免费馅饼(DP)
- HDU1176 免费馅饼
- hdu1176---免费馅饼
- HDU1176免费馅饼
- hdu1176免费馅饼(DP)
- 如何在Win7/Vista下聆听最佳质量的音乐?(数字输出 by WASAPI)
- /bin/sh: can't access tty; job control turned off
- asp.net结合ajaxfileupload控件上传文件一直提示undefined问题
- 【从CSLA中学C#】1 多语言的微软默认解决方案:ResourceManager
- m)->p_fref[0]指向是参考帧的Y
- HDU1176 免费馅饼
- Lazarus 使用KbmMemTable控件
- .NET中的Drag and Drop操作(一)
- Delphi五种设计模式
- VC++多线程编程
- 关于Indy控件内存泄露的问题
- C#中类和结构的区别
- 一些js笔记
- 鱼还是熊掌:浅谈多进程多线程的选择