-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHinhVuong.java
More file actions
35 lines (35 loc) · 940 Bytes
/
HinhVuong.java
File metadata and controls
35 lines (35 loc) · 940 Bytes
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
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package baitap;
import java.util.*;
/**
*
* @author khanh
*/
public class HinhVuong {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a1=sc.nextInt();
int b1=sc.nextInt();
int c1=sc.nextInt();
int d1=sc.nextInt();
int a2=sc.nextInt();
int b2=sc.nextInt();
int c2=sc.nextInt();
int d2=sc.nextInt();
int a=Math.min(a1, a2);
int aa=Math.max(c1, c2);
int b=Math.min(b1, b2);
int bb=Math.max(d1, d2);
int za=Math.abs(aa-a);
int zb=Math.abs(bb-b);
if(za>zb){
System.out.println(za*za);
}
else{
System.out.println(zb*zb);
}
}
}