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

崩溃(G++死活不过)谁知道问题出在哪里??!!

Posted by B06350214 at 2008-08-18 17:19:57 on Problem 1905
#include<stdio.h>
#include<string.h>
#include<math.h>
double  INF;

double  ll;
double  find(double len)
{
    double r = INF, l = 0;
    double  mid, tmp;
    int  i;
    //while(fabs(r-l) > 1e-12)
    for(i = 0; i < 100; i++)
    {
        mid = (l+r)/2;
        tmp = 2*mid*asin(len/2/mid);
		//printf("%lf\n", tmp);
        if(fabs(tmp-ll) < 1e-12) return  mid;
        else  if(tmp < ll)
            r = mid;
        else  l = mid;
    }
	return 0;
}


int  main()
{
    double l, t, c;
    double  tmp;
	INF = 400000000;
	INF *= INF;
    while(scanf("%lf %lf %lf", &l, &t, &c) != EOF && fabs(l+1) > 1e-12)
    {
        if(fabs(l) < 1e-12){ printf("0.000\n"); continue; }
        ll = (1+t*c)*l;
		tmp = find(l);
        printf("%.3lf\n", tmp-sqrt(tmp*tmp-l*l/4));
    }
    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