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

where is wrong?

Posted by huangkun at 2007-08-13 00:28:36 on Problem 1905
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
    double t,d,l,n,c,r;
    double a,b;
    while(1)
    {
        cin>>d>>n>>c;
        if(d<0.0||n<0.0||c<0.0)break;
        l=(1+n*c)*d/2.0;
        d/=2.0;
        a=0.0;b=asin(1);
        while(b-a>1e-15)
        {
            t=(a+b)/2;
            if(t*d-l*sin(t)>0)b=t;
            else a=t;
        }
        r=l/t;
        cout<<fixed<<setprecision(3)<<r-r*cos(t)<<endl;
    }
    
    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