10522 - Height to Area

All about problems in Volume 105. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

10522 - Height to Area

Post by Observer » Thu Jul 03, 2003 8:28 am

I don't understand:

Area of triangle ABC = 1/2 * AC * Hb
Or AC = 2 * Area / Hb

Now, for the case "31.573 22.352 63.448",
Sample output is "222.434"
AC = 2 * 222.434 / 22.352 = 19.903
which is shorter than Ha, Hb and also Hc !!!!! How could that be?

Plz... Any hints? Thx in advance!
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

hujialie
New poster
Posts: 43
Joined: Thu Apr 17, 2003 10:24 am
Location: Shanghai,China

Post by hujialie » Thu Jul 03, 2003 8:52 am

To observer:

The sample is wrong.
If you attend this contest,you'll get it on the clarification board. :)

Correct output should be:

1517.456

Good luck.
Retired from SJTU Accelerator 2004

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam » Thu Jul 03, 2003 4:20 pm


I request you not to submit the problem.
because the online judge has put the incorrect(without the correction during the contest) problems there.
I mailed them. i think they will fix them very soon.
So please wait and sorry for the mistake..
"Everything should be made simple, but not always simpler"

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam » Fri Jul 04, 2003 8:51 am


The problems are ok.
sample in out wrong. other things are ok
"Everything should be made simple, but not always simpler"

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer » Fri Jul 04, 2003 9:15 am

So what IS the correct output?
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

turuthok
Experienced poster
Posts: 193
Joined: Thu Sep 19, 2002 6:39 am
Location: Indonesia
Contact:

Post by turuthok » Fri Jul 04, 2003 11:41 am

Output for Sample Input:
-----------------------------

1517.456
2219.941
311.804
These are invalid inputs!
The fear of the LORD is the beginning of knowledge (Proverbs 1:7).

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Post by anupam » Fri Jul 04, 2003 8:03 pm

yes thats the corrected outs
"Everything should be made simple, but not always simpler"

User avatar
Moni
Experienced poster
Posts: 202
Joined: Fri Mar 22, 2002 2:00 am
Location: Chittagong. CSE - CUET
Contact:

Post by Moni » Sat Jul 05, 2003 6:07 pm

turuthok wrote:Output for Sample Input:
-----------------------------

1517.456
2219.941
311.804
These are invalid inputs!
Thanks! Turuthok! It should be in question as soon as possible! :oops:
ImageWe are all in a circular way, no advances, only moving and moving!

windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

10522

Post by windows2k » Sat Aug 23, 2003 7:14 am

I don't know why WA after rejudge
That is my code. Could someone tell me what's wrong?
Thx:)
[cpp]
#include <stdio.h>
#include <math.h>
double ha,hb,hc,t1,t2,t3,t4,t5,x,s;
int n;
int main()
{
scanf("%d",&n);
while(scanf("%lf %lf %lf",&ha,&hb,&hc)==3)
{
t1=hc/ha;t2=hc/hb;
t4=(1+t1+t2)*0.5;
t5=t4*(t4-1)*(t4-t1)*(t4-t2);
if(t5<=0&&!((1+t1)>t2&&(1+t2)>t1&&(t1+t2)>1))
{
puts("These are invalid inputs!");
if(--n==0) break;
}
else {
t5=sqrt(t5);
x=hc*0.5/t5;
double area=t5*x*x;
printf("%.3lf\n",area);
}
}
return 0;
}

[/cpp][/code]

nonstop
New poster
Posts: 14
Joined: Fri Oct 03, 2003 5:13 am

10522

Post by nonstop » Mon Oct 20, 2003 8:49 pm

in 10522
i carculate :
area=(a*b*c*a*b*c)/sqrt((a*b+b*c+a*c)*(a*b+b*c-a*c)*(a*b+a*c-b*c)
*(b*c+a*c-a*b))

am i wrong???
it execuate correctly when using acm's sample

what's the condition 'invalid' ???

please tell me~~ thank you very much!!!

Maarten
Experienced poster
Posts: 108
Joined: Sat Sep 27, 2003 5:24 pm

Post by Maarten » Tue Oct 21, 2003 11:46 am

did you consider the case where either one of a,b,c is equal to zero?

Maarten
Experienced poster
Posts: 108
Joined: Sat Sep 27, 2003 5:24 pm

Post by Maarten » Tue Oct 21, 2003 12:07 pm

I'm getting WA too.. I think I took care of everything.. possibility that either height is zero. I assume negative height doesn't occur, I wouldn't know the meaning of it anyway. Can anybody help me? My program is here, I think it's pretty straighforward:

[cpp]#include <stdio.h>
#include <math.h>

int main(int argc, char *argv[])
{
int n;
double ha, hb, hc, a, b, c, d;
scanf( "%d\n", &n );
for( int i=0; i<n; ) {
scanf( "%lf %lf %lf\n", &ha, &hb, &hc );
if( (ha == 0.0 && hb == 0.0) || (ha == 0.0 && hc == 0.0) || (hb == 0.0 && hc == 0.0) )
printf( "0.000\n" );
else if( ha == 0.0 || hb == 0.0 )
printf( "These are invalid inputs!\n" );
else {
a = hc/ha;
b = hc/hb;
c = 1-a*a-b*b;
d = 4*a*a*b*b-c*c;
//printf( "%.3lf %.3lf, %.3lf, %.3lf\n", a, b, c, d);
if( d < 0 ) {
i++;
printf( "These are invalid inputs!\n" );
} else
printf( "%.3lf\n", hc*hc/sqrt(d) );
}
}
return 0;
}
[/cpp]

nonstop
New poster
Posts: 14
Joined: Fri Oct 03, 2003 5:13 am

...

Post by nonstop » Tue Oct 21, 2003 8:38 pm

[quote="Maarten"]did you consider the case where either one of a,b,c is equal to zero

int AC = 2*area/b;
int BC =2*area/a;
my invalid condition is : AC<a,b,c && BC<a,b,c
and one of a,b,c equal to 0;


please give me more hints.....thank you!!

Maarten
Experienced poster
Posts: 108
Joined: Sat Sep 27, 2003 5:24 pm

Post by Maarten » Tue Oct 21, 2003 9:21 pm

well i'm sorry i can't really help you as i still got WA too... so maybe someone else can help us out ?

Towhid
New poster
Posts: 38
Joined: Wed May 28, 2003 5:30 pm
Location: Bangladesh
Contact:

Post by Towhid » Wed Oct 22, 2003 5:29 pm

ha,hb,hc can be negative. Consider this case. And Marteen why u out put 0.000 when two of ha,hb,hc is 0?
From 0 to 0

Post Reply

Return to “Volume 105 (10500-10599)”