- Vijos
- 2021-03-15 13:23:38 @
P1007
import java.util.*;
import java.lang.*;
import java.text.*;
import java.io.*;
class pnt{
double x,y;
public pnt(double x,double y)
{
this.x=x;this.y=y;
}
};
class problem
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int n;
n=sc.nextInt();
double R;
R=sc.nextDouble();
pnt[] p=new pnt[n];
for (int i=0;i<n;i++)
{
double x=sc.nextDouble();
double y=sc.nextDouble();
pnt tmp=new pnt(x,y);
p[i]=tmp;
}
double ans=0;
for (int i=1;i<n;i++)
{
double x=p[i].x-p[i-1].x,y=p[i].y-p[i-1].y;
ans+=Math.sqrt(x*x+y*y);
}
if (n>1)
{
double x=p[0].x-p[n-1].x,y=p[0].y-p[n-1].y;
ans+=Math.sqrt(x*x+y*y);
}
ans+=2*Math.PI*R;
DecimalFormat fmt=new DecimalFormat("0.00");
System.out.println(fmt.format(ans));
}
}
0 条评论
目前还没有评论...