标签:des style blog http color java os strong
6 5 1 4 1 6 1 7 2 7 2 8 3 0
4
#include<cstdio> #include<cstring> int dp[110000][12]; int max(int v,int u) { return v>u?v:u; } int main() { int i,j,s,t,m,Max; while(scanf("%d",&m),m) { memset(dp,0,sizeof(dp)); Max=0; while(m--) { scanf("%d%d",&s,&t); dp[t][s]++; if(Max<t) Max=t; } for(i=Max-1;i>=0;i--) { dp[i][0]+=max(dp[i+1][0],dp[i+1][1]); for(j=1;j<=10;j++) { dp[i][j]+=max(max(dp[i+1][j-1],dp[i+1][j]),dp[i+1][j+1]); } } printf("%d\n",dp[0][5]); } }
标签:des style blog http color java os strong
原文地址:http://blog.csdn.net/hpuhjl/article/details/38346105