标签:des style blog http io color os ar java
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 26427 Accepted Submission(s): 8998
1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 int n,x,t,dp[100005][15]; 5 int max_(int a,int b) 6 { 7 return (a>=b)?a:b; 8 } 9 int main() 10 { 11 int i,j,a,b,maxt,max; 12 while(scanf("%d",&n),n) 13 { 14 maxt=0; 15 memset(dp,0,sizeof(dp)); 16 for(i=1;i<=n;i++) 17 {///每一秒看作是一个层 这样就和数塔的意思一样了 18 scanf("%d %d",&a,&b); 19 dp[b][a+1]+=1; 20 if(b>maxt) maxt=b;///上界 21 } 22 for(i=maxt;i>=0;i--) 23 { 24 for(j=1;j<=11;j++) 25 {///当前状态取决于他的子状态 26 dp[i][j]+=max_(max_(dp[i+1][j-1],dp[i+1][j]),dp[i+1][j+1]); 27 } 28 } 29 printf("%d\n",dp[0][6]);///忘记考虑起始点 30 } 31 return 0; 32 }
标签:des style blog http io color os ar java
原文地址:http://www.cnblogs.com/linxhsy/p/4068391.html