[Task 9] Triangles is checker wrong?

Back to General discussions forum

Mario P Alexandre     2015-01-06 20:29:23

According to the Wikipedia article that is linked in the task (link), a triangle can exist if the sum of the lengths of any two sides is greater than or equal to the length of the remaining side. (specific section).

When given input data that includes a triplet such as 426 891 309, the checker is stating that the a triangle cannot be made but 426+891 is greater than 309, so the triangle should exist. This is just one example of an input triplet that is giving a false negative result (in my opinion) and in turn causing me to fail the task.

If I am misunderstanding the task, please let me know. Thank you.

Further example, here is my answer:

1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1

Here is the expected answer:

1 1 0 1 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 1 0 0 1 0

Here is the input data:

29
663 416 431
1189 682 707
426 891 309
739 557 1011
323 661 223
338 682 434
1356 312 548
156 264 193
686 1257 1201
409 278 147
749 1383 1076
914 543 983
996 1105 2498
360 149 144
1820 639 1245
366 815 617
2078 1276 958
720 436 266
1352 569 700
760 553 392
3066 1548 827
1387 1776 982
443 252 289
834 196 348
528 718 497
504 699 1576
1595 889 589
152 160 129
156 386 217
nicolas_patrois     2015-01-06 20:40:28
User avatar

Try to draw such a triangle.

I think that you are misunderstanding the triangular inequalities.

Mario P Alexandre     2015-01-06 20:49:21

Yes, I was misunderstanding the inequalities. Geometry/Trig was never my strong suit in school. I think I get it now. Thank you.

Mario P Alexandre     2015-01-06 20:58:30

I didn't realize that it really is three inequalities in one, I thought based on the wording that it was a single inequality equation. That is what tripped me up.

I fixed my code and was able to solve the task. Thanks for the help.

colcrunch     2018-05-07 08:39:11

?I am still lost, could someone expand on what the misunderstanding was?

Quandray     2018-05-07 10:14:21
User avatar

A triangle cannot have sides of length 426 891 309, because 891 is longer than 426+309.

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