| ||||||||||
| 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 | |||||||||
已经AC了,不过我上面的做法错在哪里?还有下面这种也是WAIn Reply To:为什么还是WA,我实在转不过来了. Posted by:Essence_me at 2005-07-30 10:35:27 #include <stdio.h>
#include <math.h>
#define ABS(x) (((x)<0)?(-(x)):((x)))
void main()
{
float m1,m2,a,x,y,c;
double h1,h2,c1;
while(scanf("%f",&x)==1)
{
if(scanf("%f",&y)!=1)break;
if(scanf("%f",&c)!=1)break;
m1=0;
m2=(x<y)?(x):(y);
while(1)
{
a=(m2+m1)/2;
h1=sqrt(x*x-a*a);
h2=sqrt(y*y-a*a);
c1=(h1*h2)/(h1+h2);
if(ABS(c1-c)<0.001)break;
else if(c<c1)m1=a;
else m2=a;
}
printf("%.3f\n",a);
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator