Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

题目好水,我是以座标DP的,最后一个点不一定要走,只要前面的点走过来可以超过后面的点也算的。

Posted by yygy at 2012-11-14 01:36:12 on Problem 1925
dp[i]代表飞到座标i的最少步数
for(i=1;i+1<n;i++)
		{
			if(p[i].y<p[0].y)continue;
			lim=p[i].y*p[i].y-(p[i].y-p[0].y)*(p[i].y-p[0].y);

			for(j=0;j*j<=lim&&p[i].x-j>=p[0].x;j++)
			{
				
				if(dp[p[i].x-j]!=INF)
				{
					int st=p[i].x+j;
					if(st>p[n-1].x)st=p[n-1].x;
					if(dp[p[i].x-j]+1<dp[st])
					{
						dp[st]=dp[p[i].x-j]+1;
					}
				}
			}
		}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator