Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.Threading;
- public class InsideTheBuilding
- {
- public static void Main()
- {
- Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
- checked
- {
- int size = int.Parse(Console.ReadLine());
- for (int i = 0; i < 5; i++)
- {
- int pointX = int.Parse(Console.ReadLine());
- int pointY = int.Parse(Console.ReadLine());
- bool pointIsInsideBase = CheckThePointIsInsideTheBase(size, pointX, pointY);
- bool pointIsInsideTower = CheckThePointIsInsideTheTower(size, pointX, pointY);
- if (pointIsInsideBase || pointIsInsideTower)
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- }
- }
- }
- private static bool CheckThePointIsInsideTheTower(int size, int pointX, int pointY)
- {
- checked
- {
- int minX = size, maxX = 2 * size;
- int minY = size, maxY = 4 * size;
- bool isInside = pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;
- return isInside;
- }
- }
- private static bool CheckThePointIsInsideTheBase(int size, int pointX, int pointY)
- {
- checked
- {
- int maxX = 3 * size;
- int maxY = size;
- bool isInside = pointX >= 0 && pointX <= maxX && pointY >= 0 && pointY <= maxY;
- return isInside;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement