Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ComplexConditionalStatements;
- import java.util.*;
- public class PointInTheFigure {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Scanner input = new Scanner(System.in);
- int h = Integer.parseInt(input.nextLine());
- int x = Integer.parseInt(input.nextLine());
- int y = Integer.parseInt(input.nextLine());
- // dolen pravougulnik
- int x1dolen = 0;
- int y1dolen = 0;
- int x2dolen = x1dolen + 3 * h;
- int y2dolen = y1dolen + h;
- // shared wall
- int border1x = x1dolen + h;
- int border1y = y1dolen + h;
- int border2x = x1dolen + 2 * h;
- // goren pravougulnik
- int x1goren = 2 * h;
- int y1goren = 4 * h;
- int x2goren = x1dolen + h;
- int y2goren = y1goren - 3 * h;
- if ((x > x1goren && x < x2goren && y > y1goren && y < y2goren)
- || ((x > border1x && x < border2x ))
- || (x > x1dolen && x < x2dolen && y > y1dolen && y < y2dolen)) {
- System.out.println("Inside");
- }
- else if (!(x >= x1dolen && x <= x2dolen && y >= y1dolen && y <= y2dolen)) {
- System.out.println("Outside");
- }
- else if ((x == x1dolen || x == x2dolen || y == y1dolen || y == y2dolen) || ((x == border1x && x == border2x ))
- || (x == x1goren && x == x2goren && y == y1goren && y == y2goren))
- System.out.println("Border");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement