From ba2cb50d4eb86ece8764d4751ace057a44f528d2 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Thu, 28 Apr 2016 08:51:47 +0800 Subject: [PATCH] Create 1008.cpp --- QUSTOJ/1008.cpp | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 QUSTOJ/1008.cpp diff --git a/QUSTOJ/1008.cpp b/QUSTOJ/1008.cpp new file mode 100644 index 0000000..def939a --- /dev/null +++ b/QUSTOJ/1008.cpp @@ -0,0 +1,74 @@ +#include +#include +#include +#include + +using namespace std; + +const double PI=3.1415926; + +typedef struct +{ + double x,y; + int vis; +}point_struct; + +point_struct point[105]; + +int main() +{ + //Initialize + memset(point,0,sizeof(point_struct)*105); + double r; + double line_length=0; + int n; + //Input + scanf("%d %lf",&n,&r); + for(int i=0;ithis_distance) + { + min_distance=this_distance; + min_distance_point=i; + } + } + } + point[checking_point].vis=1; + line_length+=min_distance; + checking_point=min_distance_point; + checked_point++; + } + double final_distance=sqrt((point[checking_point].x-point[0].x)*(point[checking_point].x-point[0].x)+(point[checking_point].y-point[0].y)*(point[checking_point].y-point[0].y)); + line_length+=final_distance; + line_length+=2*PI*r; + printf("%.2lf\n",line_length); + return 0; +}