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 |
Re:注意r是double类型In Reply To:注意r是double类型 Posted by:pudding110 at 2011-03-16 20:15:49 > AC代码 > #include <iostream> > #include <cstring> > #include <string> > #include <stdio.h> > #include <stdlib.h> > #include <cmath> > using namespace std; > double pi=3.141592653589793; > > int main() > { > int n,i; > double sum,r; > double data[501][2]; > while(scanf("%d %lf",&n,&r)!=EOF) > { > sum=0; > for(i=0;i<n;i++) > { > scanf("%lf %lf",&data[i][0],&data[i][1]); > if(i>0) > sum +=sqrt(pow(data[i][0]-data[i-1][0],2)+pow(data[i][1]-data[i-1][1],2)); > } > sum+=sqrt(pow(data[n-1][0]-data[0][0],2)+pow(data[n-1][1]-data[0][1],2)); > sum+=2*pi*r; > printf("%.2lf\n",sum); > > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator