Advertisement
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());
- if ((x > 0 && x < 3 * h ) && (y < h && y > 0)) {
- System.out.println("Inside");
- } else if ((x > h && x < 2 * h) && (y >= h && y < 4 * h)) {
- System.out.println("Inside");
- } else if ((x < 0 && x > 3 * h) || ((x > 2 * h) && (y > h))
- || (x > 0 && x < h && y > h) || (y > 4 * h)
- || (x < 0 || y < 0) || (x==0 && y>h) || (y==0 && x>3*h) || (x>3*h)) {
- System.out.println("Outside");
- } else {
- System.out.println("Border");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement