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

只保存上一个坐标和第一个坐标就够了,附小代码

Posted by Eov_Second at 2016-12-06 18:48:17 on Problem 1939
#define Y scanf("%lf%lf",x+p, y+p)
#define Z(k) (k[0]+k[1])/2
int main()
{
	double x[3], y[3];
	int n, p; while (scanf("%d", &n) > 0)
	{ 
		printf("%d ", n); 
		p = 0; 
		Y; 
		x[2] = x[0]; y[2] = y[0]; p = 1; 
		while (--n)
		{ 
			Y;
			printf("%lf %lf ", Z(x), Z(y)); p ^= 1; 
		}
		x[p] = x[2]; y[p] = y[2]; 
		printf("%lf %lf ", Z(x), Z(y)); 
		putchar(10); 
	}
}

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