Advertisement
_Kripaka001_

Untitled

Jan 24th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. # include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int a=0;
  9.     cin>>a;
  10.     int o=0;
  11.     cin>>o;
  12.     double r=0;
  13.     double p[a][2];
  14.     double n = (2 * M_PI)* o;
  15.     for(int i=0;i<a;i++)
  16.     cin>>p[i][0]>>p[i][1];
  17.  
  18.     for(int i=0;i<a;i++)
  19.         r+=sqrt((p[i][0]-p[i-1][0])*(p[i][0]-p[i-1][0]) + (p[i][1]-p[i-1][1])*(p[i][1]-p[i-1][1]));
  20.  
  21.     r=r+n;
  22.     r+=sqrt((p[0][0]-p[a-1][0])*(p[0][0]-p[a-1][0]) + (p[0][1]-p[a-1][1])*(p[0][1]-p[a-1][1]));
  23.     cout<<round(r*100)/100;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement