|
|
back to boardDiscussion of Problem 1020. Ropenow on tesst 2 Posted by holtaf 15 Nov 2010 00:21 #include<vector> #include<iostream> #include<math.h> using namespace std; int main() { vector<double>x; vector<double>y; int n; double r,t; cin>>n>>r; for(int i=0;i<n;i++) { cin>>t; x.push_back(t); cin>>t; y.push_back(t); } double l=0; for(int j=0;j<n;j++) { if(j==n-1) l+=sqrt(pow(x[j]-x[0],2)+pow(y[j]-y[0],2)); else l+=sqrt(pow(x[j+1]-x[j],2)+pow(y[j+1]-y[j],2)); } double pi=3.14; l+=r*pi*(n/2); cout<<l; return 0; } |
|
|