Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

别省着 double 用 float

Posted by 041221125 at 2006-08-16 13:56:04 on Problem 2365
In Reply To:哪为 N人 帮我 看看程序 啊 Posted by:DancingBlue at 2006-08-16 13:39:33
> #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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator