#pragma warning(disable:4996)
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>
#include<time.h>
using namespace std;
int dp[100005][15];
int main()
{
int n;
while (cin >> n, n)
{
memset(dp, 0, sizeof(dp));
int t = 0;
for (int i = 1; i <= n; i++)
{
int a, b;
cin >> a >> b;
dp[b][a + 1]++;
if (b > t)
t = b;
}
for (int i = t - 1; 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;
}
HDU 1176(数塔)
最新推荐文章于 2021-03-22 09:06:05 发布