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

wa大神帮帮忙,看看我哪错了。

Posted by a3333 at 2011-03-06 17:24:29 on Problem 2365
#include <iostream>
#include <math.h>
#include <string>
#include <iomanip>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#define PI acos(double(-1))
using namespace std;    
int main(){
	cout<<setiosflags(ios::fixed);
	int n;
	double radix,x,y,sum=0,xo,yo;
	cin>>n>>radix;
	cin>>xo>>yo;
	if (n!=1)
{
	int xini=xo,yini=yo;
		for (int i=0;i<n-1;i++)
		{
			cin>>x>>y;
			sum+=sqrt((x-xo)*(x-xo)+(y-yo)*(y-yo));
			xo=x;yo=y;
		}
		sum+=sqrt((x-xini)*(x-xini)+(y-yini)*(y-yini));
}
	sum=sum+2*acos(double(-1))*radix;
	cout<<setprecision(2)<<sum<<endl;
    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