시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 1024 MB | 200 | 165 | 152 | 83.978% |
Determine if it is possible to produce two triangles of given side lengths, by cutting some rectangle with a single line segment, and freely rotating and flipping the resulting pieces.
Hint: The Pythagorean Theorem states that for any right triangle a2+b2=c2, where c is the length of the hypotenuse and a and b are the lengths of the remaining sides.
The first line of input contains a positive integer n, indicating the number of problem sets. Each problem set consists of two lines. The first line contains three space-separated positive integers, indicating the desired side lengths of the first triangle. Similarly, the second line contains three space-separated positive integers, denoting the desired side lengths of the second triangle. It is not guaranteed that the side lengths produce valid right triangle. All side lengths are less than or equal to 100.
For each problem set print, on a single line, whether there exists a rectangle which could have been cut to form triangles of the given side lengths. If such a rectangle exists, print YES. Otherwise, print NO.
3 3 4 5 4 3 5 3 4 6 4 6 3 39 52 65 25 60 65
YES NO NO
High School > PLU High School Programming Contest > PLU 2016 > Novice 11번