Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
wa大神帮帮忙,看看我哪错了。#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator