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

Help!

Posted by ACM29001 at 2004-10-13 23:11:06 on Problem 1905
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;

double pi=asin(1.0f);
double GetAng(double R){
    double re,mid,hig = pi,low=0;
    while( hig-low > 10e-8){
        mid = (hig+low)/2.0f;
        re = mid/sin(mid);
        if(re>R)hig=mid;
        else if(re<R)low=mid;
        else break;
    }
    return mid;
}

int main(void){
    double L,n,C,a;
    while(true){
        scanf("%lf %lf %lf",&L,&n,&C);
        if(L<0 || n<0 || C<0)break;
        a = GetAng(1.0f+n*C);
        printf("%.3lf\n", L*( (1.0f-cos(a)) / (2*sin(a))) );
    }
    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