| ||||||||||
| 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:为什么总是waIn Reply To:为什么总是wa Posted by:huxinjie800 at 2009-10-14 23:19:10 > #include <iostream>
> #include <math.h>
> #define pi acos(double(-1))
> using namespace std;
> struct node
> {
> double x,y;
> };
> int main ()
> {
> int n,r,i;
> node head,temp1,temp2;
> double sum;
> while(scanf("%d%d",&n,&r)!=EOF)
> {
> sum=0;
> scanf("%lf%lf",&head.x,&head.y);
> temp1.x=head.x;temp1.y=head.y;
> for(i=1;i<n;i++)
> {
> scanf("%lf%lf",&temp2.x,&temp2.y);
> sum+=sqrt((temp1.x-temp2.x)*(temp1.x-temp2.x)+(temp1.y-temp2.y)*(temp1.y-temp2.y));
> temp1.x=temp2.x;temp1.y=temp2.y;
> }
> temp2.x=head.x;temp2.y=head.y;
> sum+=sqrt((temp1.x-temp2.x)*(temp1.x-temp2.x)+(temp1.y-temp2.y)*(temp1.y-temp2.y));
> sum+=2*pi*r;
> printf("%.2lf\n",sum);
> }
> }
气死了,原来半径可以是小数。。。。一个晚上就这么没有了/。。。。。。以后。。。。一定要看清题目,,,,,,。。。。。。
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator