-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_11596.java
More file actions
39 lines (32 loc) · 1.07 KB
/
Copy pathBOJ_11596.java
File metadata and controls
39 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// BOJ - 11596
// Problem Sheet - https://www.acmicpc.net/problem/11596
import java.util.*;
import java.io.*;
public class Main {
private static int[] rectA, rectB;
public static void main(String[] args) throws IOException {
input();
System.out.println(solve() ? "YES" : "NO");
}
private static void input() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
rectA = Arrays.stream(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.sorted()
.toArray();
rectB = Arrays.stream(br.readLine().split(" "))
.mapToInt(Integer::parseInt)
.sorted()
.toArray();
br.close();
}
private static boolean solve() {
if (!Arrays.equals(rectA, rectB)) {
return false;
}
return isRightTriangle(rectA);
}
private static boolean isRightTriangle(int[] rect) {
return Math.pow(rect[0], 2) + Math.pow(rect[1], 2) == Math.pow(rect[2], 2);
}
}