Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by LittleSucks on 26.1.2017 г..
- */
- public class p13_PointInTheFigure {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int h = Integer.parseInt(input.nextLine());
- int x = Integer.parseInt(input.nextLine());
- int y = Integer.parseInt(input.nextLine());
- // Borders check
- boolean borderCheck1 = (y >= 0 && y <= h) && x == 0;
- boolean borderCheck2 = (y >= 0 && y <= h) && x == h * 3;
- boolean borderCheck3 = (x >= 0 && x <= h * 3) && y == 0;
- boolean borderCheck4 = (x >= 0 && x <= h * 3) && y == h;
- boolean borderCheck5 = (y >= 0 && y <= h * 4) && x == h;
- boolean borderCheck6 = (y >= 0 && y <= h * 4) && x == h * 2;
- boolean borderCheck7 = (y >= h * 2 && y <= h * 4) && x == h * 2;
- boolean borderCheck8 = (y >= h * 2 && y <= h * 4) && x == h * 3;
- boolean borderCheck9 = (y >= h * 2 && y <= h * 4) && x == h * 4;
- boolean borderChecker = borderCheck1 || borderCheck2 || borderCheck3 || borderCheck4 ||
- borderCheck5 || borderCheck6 || borderCheck7 || borderCheck8 || borderCheck9;
- // end of borders check
- // **************************************************************
- // Inside check && don't touch the border
- boolean insideCheck1 = (x > 0 && x < h * 3) && (y > 0 && y < h) && (x != h && x != h * 2);
- boolean insideCheck2 = (y > h && y < h * 4) && (x > h && x < h * 2) && (y != h * 2 && y != h * 3 && y != h * 4);
- boolean insideChecker = insideCheck1 || insideCheck2;
- // end of Inside check && don't touch the border
- if (borderChecker) {
- System.out.println("border");
- } else if (insideChecker) {
- System.out.println("inside");
- } else if(!borderChecker && !insideChecker) {
- System.out.println("outside");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement