[BOJ 11596] Triangle

View as PDF

Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 256M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

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.

입력 형식

The input 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 guaranteed that the side lengths produce valid triangles. All side lengths are less than or equal to 100.

출력 형식

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

3 4 5
4 3 5

예제 출력 1

YES

예제 입력 2

3 4 6
4 6 3

예제 출력 2

NO

예제 입력 3

39 52 65
25 60 65

예제 출력 3

NO

Comments

There are no comments at the moment.