| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪为 N人 帮我 看看程序 啊#include<stdio.h>
#include<math.h>
#define P 3.1415927
int main(){
float x,y,xo,yo,a,b,c;
double l;
int n,i,r;
scanf("%d%d",&n,&r);
scanf("%f%f",&x,&y);
a=x;
b=y;
l=0;
for(i=1;i<n;i++){
scanf("%f%f",&xo,&yo);
x-=xo;
y-=yo;
l+=sqrt(x*x+y*y);
x=xo;
y=yo;
}
x-=a;
y-=b;
l+=sqrt(x*x+y*y);
c=360*n-(n-2)*180-n*180;
l+=(2*P*r*c)/360;
printf("%.2f\n",l);
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator