Advertisement
veronikaaa86

Point In The Figure

Oct 2nd, 2017
180
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 PointInTheFigure1 {
  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.  
  12.  
  13.         if ((x>=0 && x<=h*3 && y>=0 && y<=h) || (x>=h && x<=h*2 && y>=h && y<=h*4)) {
  14.             if ((x>0 && x<h*3 && y>0 && y<h) || (x > h && x < h * 2 && y > h && y < h * 4)) {
  15.                 System.out.println("inside");
  16.             } else {
  17.                 if (x > h && x < h * 2 && y == h) {
  18.                     System.out.println("inside");
  19.                 } else {
  20.                     System.out.println("border");
  21.                 }
  22.             }
  23.         } else {
  24.             System.out.println("outside");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement