[BOJ 13755] It Takes Three

View as PDF

Submit solution

Points: 2
Time limit: 2.0s
Memory limit: 512M

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

Given three rectangles, determine if they can be glued together to form a square. The rectangles can be rotated, but they cannot overlap.</p>

Here’s an example of how three rectangles, 8x2, 1x6 and 7x6, can be put together to form a square 8x8:

입력 형식

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. There will be exactly three lines of input.</p>

The first line of input contains two integers w1 and h1 (1 ≤ w1,h1 ≤ 100), which are the width and height of the first rectangle.

The second line of input contains two integers w2 and h2 (1 ≤ w2,h2 ≤ 100), which are the width and height of the second rectangle.

The third line of input contains two integers w3 and h3 (1 ≤ w3,h3 ≤ 100), which are the width and height of the third rectangle.

출력 형식

Output 1 if the two rectangles can be put together to form a square, and 0 of they cannot.

예제 입력

8 2
1 6
7 6

예제 출력

1

Comments

There are no comments at the moment.