Problem 52 Pythagorean Theorem Incorrect Example

Back to General discussions forum

Scaevola     2014-12-20 05:26:12

The example results and the testing program are WRONG. The acute (A) and obtuse (O) symbols are all swapped. Check it by hand if you don't believe me. To pass, I had to give the INCORRECT answer. Please fix this.

Rodion (admin)     2014-12-20 06:05:03
User avatar

Hi! Thanks for your message!

Could you please explain this a bit, as I am somewhat bewildered. I can't at once understand either I put something wrong in the problem statement or the checker / example is wrong in some way... :-o

Is the example given incorrect? I.e.:

input data:
3
6 8 9
9 12 15
16 12 22

answer:
A R O

I tried to check by hand, for example, hypotenuse of the right triangle with sides of 6 and 8 is:

sqrt(6*6 + 8*8) = sqrt(100) = 10

but since the real length of the third side is 9, which is shorter, it seems to be acute case...

And on the other hand, for the third case right triangle with sides 16 and 12 has hypotenuse of 20:

sqrt(16*16 + 12*12) = sqrt(400) = 20

but the third side is given 22, longer than necessary - so the angle between smaller sides is obtuse.

Is this correct? Or I am mistaking something?

Or the mistake is in generated input data? Could you please paste here an example of input and expected answer here, so we can discuss it?

Thanks in advance for your help!

Scaevola     2014-12-22 02:06:00

Well, looks like I'll eat my own words! :) Frankly, I was curious why we were using the pythagorean theorem on a non-right triangle. All it was telling me is that one right-triangle is larger than another.

Anyway, I found this on Wikipedia:

A corollary of the Pythagorean theorem's converse is a simple means of determining whether a triangle is right, obtuse, or acute, as follows. Let c be chosen to be the longest of the three sides and a + b > c (otherwise there is no triangle according to the triangle inequality). The following statements apply:

If a^2 + b^2 = c^2, then the triangle is right.

If a^2 + b^2 > c^2, then the triangle is acute.

If a^2 + b^2 < c^2, then the triangle is obtuse.

Maybe you could rephrase your definitions of when a triangle is acute or obtuse? Preferably using a mathematical expression. Thanks.

Rodion (admin)     2014-12-22 08:59:02
User avatar

> Frankly, I was curious why we were using the pythagorean theorem on a non-right triangle.

Yes, I'm afraid you are right - it is quite bewildering :-o

I'll try to review the problem statement - it was written long ago and now I really see it is far enough from being clear :(

Thanks a lot for pointing this! And if you will find some other statements also vague and unclear - please do not hesitate to tell about them too - this would be of much help!

Please login and solve 5 problems to be able to post at forum