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

Re:注意r是double类型

Posted by zyzzyh008 at 2011-09-30 15:33:39 on Problem 2365
In Reply To:注意r是double类型 Posted by:pudding110 at 2011-03-16 20:15:49
> AC代码
> #include <iostream>
> #include <cstring>
> #include <string>
> #include <stdio.h>
> #include <stdlib.h>
> #include <cmath>
> using namespace std;
> double pi=3.141592653589793;
> 
> int main()
> {
> 	int n,i;
> 	double sum,r;
> 	double data[501][2];
> 	while(scanf("%d %lf",&n,&r)!=EOF)
> 	{
> 		sum=0;
> 		for(i=0;i<n;i++)
> 		{
> 			scanf("%lf %lf",&data[i][0],&data[i][1]);
> 			if(i>0)
> 				sum +=sqrt(pow(data[i][0]-data[i-1][0],2)+pow(data[i][1]-data[i-1][1],2));
> 		}
> 		sum+=sqrt(pow(data[n-1][0]-data[0][0],2)+pow(data[n-1][1]-data[0][1],2));
> 		sum+=2*pi*r;
> 		printf("%.2lf\n",sum);
> 
> 	}
> 	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