Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PointInTheFigure {
- 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 firstFig = x > 0 && x < 3 * h;
- boolean firstFig1 = y > 0 && y < h;
- boolean secondFig = x > h && x < 2 * h;
- boolean secondFig1 = y > 0 && y < 4 * h;
- if ((firstFig && firstFig1) || (secondFig && secondFig1)) {
- System.out.println("inside");
- } else if((x < 0 || x > 3 * h) || (y < 0 || y > 4 * h) || (y > h && (x < h || x > 2 * h))) {
- System.out.println("outside");
- } else {
- System.out.println("border");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment