| ||||||||||
| 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 | |||||||||
太水了#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
const double pai = 3.141592654;
int main() {
int N; double R;
scanf("%d%lf",&N,&R);
double x0,y0;
double x,y,xnx,ynx;
double res = 0;
for(int i = 0; i < N; i++){
if(!i) {
scanf("%lf%lf",&x0,&y0);
x=x0,y=y0;
}
else{
scanf("%lf%lf",&xnx,&ynx);
res += sqrt((xnx-x)*(xnx-x)+(ynx-y)*(ynx-y));
x=xnx,y=ynx;
}
}
printf("%.2lf\n", res + sqrt((x-x0)*(x-x0)+(y-y0)*(y-y0))+2*pai*R);
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator