-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtriangles.java
More file actions
41 lines (34 loc) · 1.27 KB
/
Copy pathtriangles.java
File metadata and controls
41 lines (34 loc) · 1.27 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
40
41
import java.util.*;
import java.io.*;
import java.math.*;
public class triangles {
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(new File("triangles.in"));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("triangles.out")));
int num = in.nextInt();
int [] x = new int[num];
int [] y = new int[num];
for(int i = 0; i<num; i++){
x[i] = in.nextInt();
y[i] = in.nextInt();
}
int max = 0;
for(int i = 0; i<num; i++){
for(int j = 0; j<num; j++){
if(y[i] == y[j]){
for(int l = 0; l<num; l++){
if(x[i] == x[l]){
int area = (x[i] - x[j])*(y[i]-y[l]);
if(Math.abs(area)>max)max = Math.abs(area);
}else if(x[j] == x[l]){
int area = (x[i] - x[j])*(y[j]-y[l]);
if(Math.abs(area)>max)max = Math.abs(area);
}
}
}
}
}
out.println(max);
out.close();
}
}