Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Point_in_the_Figure
- {
- class Program
- {
- static void Main(string[] args)
- {
- int h = int.Parse(Console.ReadLine());
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- int botTrectXStart = 0;
- int botTrectXEnd = 3*h;
- int botTrectYStart = 0;
- int botTrectYEnd = h;
- int topRectXstart = h;
- int topRectXEnd = 2*h;
- int topRectYstart = h;
- int topRectYend = 4*h;
- int isInBotRect = -2; //-1,0,1
- int isInTopRect = -2; //-1,0,1
- bool onMiddleLine = (x < h || x > 2 * h);
- if ((x >= botTrectXStart && x <= botTrectXEnd) && (y >= botTrectYStart) && (y <= botTrectYEnd))
- {
- if ((x == botTrectXStart || x == botTrectXEnd) || ((y == botTrectYStart) || (y == botTrectYEnd) && (onMiddleLine)))
- {
- isInBotRect = 0;
- }
- else //Inside of bottom rectangle
- {
- isInBotRect = 1;
- }
- }
- else
- {
- isInBotRect = -1; //outside of bottom rectangle
- }
- if ((x >= topRectXstart && x <= topRectXEnd) && (y >= topRectYstart) && (y <= topRectYend))
- {
- if ((x == topRectXstart || x == topRectXEnd) || ((y == topRectYend) || (y == topRectYstart) && (onMiddleLine)))
- {
- isInTopRect = 0;
- }
- else //inside of top rect
- {
- isInBotRect = 1;
- }
- }
- else //inside of top rectangle
- {
- isInTopRect = -1;
- }
- if ((isInBotRect == -1) && (isInTopRect == -1))
- {
- Console.WriteLine("Outside");
- }
- else if ((isInBotRect == 0) || (isInTopRect == 0))
- {
- Console.WriteLine("Border");
- }
- else
- {
- Console.WriteLine("inside");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment