아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Triangle

시간 제한1초메모리 제한1024 MB

요약
직사각형을 한 번 잘라 얻은 두 삼각형의 세 변 길이가 주어질 때, 그 두 삼각형을 만들 수 있는지 판정한다.
난이도

보통10점 중 6점

유형
기하, 수학, 구현
정답자
아직 제출이 없습니다

문제

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.

예제1

  1. 예제 1

    입력
    3
    3 4 5
    4 3 5
    3 4 6
    4 6 3
    39 52 65
    25 60 65
    
    예상 출력
    YES
    NO
    NO