Advertisement
Svetla

PointOnBorder/21.1.2017

Jan 24th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PointInTheFigure {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int h = Integer.parseInt(scanner.nextLine());
  8.         int x = Integer.parseInt(scanner.nextLine());
  9.         int y = Integer.parseInt(scanner.nextLine());
  10.  
  11.         if ((x > 0 && x < 3 * h ) && (y < h && y > 0)) {
  12.             System.out.println("Inside");
  13.         } else if ((x > h && x < 2 * h) && (y >= h && y < 4 * h)) {
  14.             System.out.println("Inside");
  15.         } else if ((x < 0 && x > 3 * h) || ((x > 2 * h) && (y > h))
  16.                 || (x > 0 && x < h && y > h) || (y > 4 * h)
  17.                 || (x < 0 || y < 0) || (x==0 && y>h) || (y==0 && x>3*h) || (x>3*h)) {
  18.             System.out.println("Outside");
  19.         } else {
  20.             System.out.println("Border");
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement