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 KatrineYang at 2016-11-07 00:13:24 on Problem 2365
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

const double pai = 3.141592654;

int main() {
	int N; double R;
	scanf("%d%lf",&N,&R);
	double x0,y0;
	double x,y,xnx,ynx;
	double res = 0;
	for(int i = 0; i < N; i++){
		if(!i) {
			scanf("%lf%lf",&x0,&y0);
			x=x0,y=y0;
		}
		else{
			scanf("%lf%lf",&xnx,&ynx);
			res += sqrt((xnx-x)*(xnx-x)+(ynx-y)*(ynx-y));
			x=xnx,y=ynx;
		}
	}
	printf("%.2lf\n", res + sqrt((x-x0)*(x-x0)+(y-y0)*(y-y0))+2*pai*R);
	return 0;
}

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