Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://judge.softuni.bg/Contests/9/CSharp-Basics-Exam-14-April-2014-Evening
- import java.util.Scanner;
- public class InsideTheBuilding {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int size = input.nextInt();
- int x1 = input.nextInt();
- int y1 = input.nextInt();
- int x2 = input.nextInt();
- int y2 = input.nextInt();
- int x3 = input.nextInt();
- int y3 = input.nextInt();
- int x4 = input.nextInt();
- int y4 = input.nextInt();
- int x5 = input.nextInt();
- int y5 = input.nextInt();
- System.out.println(IsPointInTheBuilding(x1, y1, size));
- System.out.println(IsPointInTheBuilding(x2, y2, size));
- System.out.println(IsPointInTheBuilding(x3, y3, size));
- System.out.println(IsPointInTheBuilding(x4, y4, size));
- System.out.println(IsPointInTheBuilding(x5, y5, size));
- }
- private static String IsPointInTheBuilding(int x, int y, int size){
- boolean insideDown = (x >= 0) && (x <= 3 * size) && (y >= 0) && (y <= size);
- boolean insideUp = (x >= size) && (x <= 2 * size) && (y >= size) && (y <= 4 * size);
- boolean inside = insideDown | insideUp;
- String result = inside ? "inside" : "outside";
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment