Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by entropy on 3/31/2017.
- */
- public class Heavy {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int h = Integer.parseInt(scanner.nextLine());
- int x = Integer.parseInt(scanner.nextLine());
- int y = Integer.parseInt(scanner.nextLine());
- boolean isInsidehorizontal = false;
- boolean isInsidevertical = false;
- boolean isBorderHorizontal = false;
- boolean isBorderVertical = false;
- boolean isBorder = false;
- if ((x > 0 && x < 3 * h) && (y < h && y > 0)) {
- isInsidehorizontal = true;
- }
- if (((x >= 0) && (x <= 3 * h) && (y == 0 || y == h)) || ((y >= 0) && (y <= h)) && ((x == 0 || x == 3 * h))) {
- isBorderHorizontal = true;
- }
- if ((x > h) && (x < 2 * h) && (y < 4 * h && y > h)) {
- isInsidevertical = true;
- }
- if (((x >= h) && (x <= 2 * h) && (y == 2 * h || y == 4 * h)) || ((y >= 2 * h) && (y <= 4 * h)) && ((x == h || x == 2 * h))) {
- isBorderVertical = true;
- }
- if (isBorderHorizontal == true || isBorderVertical == true) {
- isBorder = true;
- System.out.println("border");
- }
- if (isInsidehorizontal == true || isInsidevertical == true) {
- System.out.println("Inside");
- } else if (isBorder==false){
- System.out.println("Outside");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement