Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PointInTheFigure
- {
- class Program
- {
- static void Main()
- {
- int input = int.Parse(Console.ReadLine());
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- int x1 = 0;
- int y1 = 0;
- int x2 = 3 * input;
- int y2 = input;
- int x3 = input;
- int y3 = input;
- int x4 = 2 * input;
- int y4 = 4 * input;
- bool inRectA = (x > x1 && x < x2) && (y > y1 && y < y2); //Inside horizontal rectagle(RECTENGAL A)
- bool inRectB = (x > x3 && x < x4) && (y > y3 && y < y4); //inside vertical rectangle(RECTENGAL B)
- bool rectABorder = ((x == x1 || x == x2) && (y >= y1 && y <= y2)) ||
- ((y == y1 || y == y2) && (x >= x1 && x <= x2)); // rectengal A border
- bool rectBBorder = ((x == x3 || x == x4) && (y >= y3 && y <= y4)) ||
- ((y == y3 || y == y4) && (x >= x3 && x <= x4)); // rectangle B border
- bool exeption = ((y == y2) && (x > input && x < 2 * input)); /*this is the part of rect A border where
- Conncets to rect B witch must be "inisde"
- not "Border"*/
- if ( (rectABorder || rectBBorder)&&(!exeption))
- {
- Console.WriteLine("border");
- }
- else if (inRectA || inRectB||exeption)
- {
- Console.WriteLine("inside");
- }
- else
- {
- Console.WriteLine("outside");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement