标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1176
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 35084 Accepted Submission(s): 11967
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespace std; int dp[100005][15]; int main() { int n, x, t; while(scanf("%d",&n),n) { memset(dp, 0, sizeof(dp)); for(int i=1; i<=n; i++) { scanf("%d %d", &x, &t); dp[t][x+1] += 1; } for(int i=100000; i>=0; i--) { for(int j=1; j<=11; j++) { dp[i][j] += max(dp[i+1][j],max(dp[i+1][j+1],dp[i+1][j-1])); } } printf("%d\n",dp[0][6]); } return 0; }
标签:
原文地址:http://www.cnblogs.com/mengzhong/p/5043441.html