Advertisement
erfanul007

Timus 1020

Apr 14th, 2021
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. double x[101],y[101];
  4. double len1(int i, int j){
  5.     return sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
  6. }
  7. int main(){
  8.     int n;
  9.     double r,len;
  10.  
  11.     scanf("%d %lf",&n,&r);
  12.  
  13.     for(int i=0;i<n;i++)
  14.         scanf("%lf %lf",&x[i],&y[i]);
  15.  
  16.     len=2*acos(-1.0)*r+len1(0,n-1);
  17.  
  18.     for(int i=1;i<n;i++)
  19.         len=len+len1(i-1,i);
  20.  
  21.     printf("%.2lf\n",len);
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement