Advertisement
borkins

13. Point in the Figure

Mar 28th, 2017
612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. /**
  2.  * Project: Complex_Conditions - created by borkins on 2017-03-28.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _13_PointInTheFigure
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.        
  13.         int h = Integer.parseInt(console.nextLine());
  14.         int x = Integer.parseInt(console.nextLine());
  15.         int y = Integer.parseInt(console.nextLine());
  16.        
  17.         boolean isInside = (x > 0 && x < h * 3) && (y > 0 && y < h)
  18.                            || (x > h && x < h * 2) && (y > 0 && y < h * 4);
  19.         boolean isOutside = ((x < 0 || x > h * 3) && y <= h)
  20.                             || ((x < h || x > h * 2) && y > h)
  21.                             || (y < 0 || y > h * 4);
  22.        
  23.         if (isInside) {
  24.             System.out.println("inside");
  25.         }
  26.         else if (isOutside) {
  27.             System.out.println("outside");
  28.         }
  29.         else {
  30.             System.out.println("border");
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement