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

ri tnnd

Posted by rhna at 2004-10-17 18:12:47 on Problem 1925
这道题只要依次按每个桥把坐标对折一下就可以了....



		res = -1;
		memset(delta, -1, sizeof(delta));
		delta[X[0]] = 0;
		for(i = 1; i < n; ++i) {
			int p = X[i] - (int)(sqrt((double)Y[i] * Y[i] - (double)(Y[i] - Y[0]) * (Y[i] - Y[0])) + 1e-12);
			if(p < 0) p = 0;
			for(j = p; j < X[i]; ++j) {
				if(delta[j] == -1) continue;
				j1 = 2 * X[i] - j;
				if(j1 < X[n - 1]) {
					if(delta[j1] == -1 || delta[j] + 1 < delta[j1])
						delta[j1] = delta[j] +  1;
				} else {
					if(res == -1 || delta[j] + 1 < res)
						res = delta[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