Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int x1 = in.nextInt();
- int y1 = in.nextInt();
- int x2 = in.nextInt();
- int y2 = in.nextInt();
- double dst1 = Math.sqrt(x1 * x1 + y1 * y1);
- double dst2 = Math.sqrt(x2 * x2 + y2 * y2);
- if (x1 * x2 < 0 || y1 * y2 < 0) {
- System.out.println((int)(Math.floor(dst1) + Math.floor(dst2)));
- }
- else {
- System.out.println((int)(Math.floor(Math.max(dst1, dst2)) - Math.ceil(Math.min(dst1, dst2)) + 1));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement