Advertisement
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 PointInTheFigure
- {
- class Program
- {
- static void Main(string[] args)
- {
- var h = int.Parse(Console.ReadLine());
- var x = int.Parse(Console.ReadLine());
- var y = int.Parse(Console.ReadLine());
- //First Rectangle's Coordinates:
- var x1 = 0;
- var y1 = 0;
- var x2 = 3 * h;
- var y2 = 1 * h;
- //Second Rectangle's Coordinates:
- var x3 = 1 * h;
- var y3 = 1 * h;
- var x4 = 2 * h;
- var y4 = 4 * h;
- //Internal Border's Coordinates For The Rectangles:
- var x5 = 1 * h;
- var y5 = 1 * h;
- var x6 = 2 * h;
- //Borders of The Lower Rectangle:
- var onLeftSide1 = ((x == x1) && (y >= y1 && y <= y2));
- var onRightSide1 = ((x == x2) && (y >= y1 && y <= y2));
- var onBottom1 = ((y == y1) && (x >= x1 && x <= x2));
- var onTopLeft1 = ((y == y2) && (x >= x1 && x <= x3));
- var onTopRight1 = ((y == y2) && (x >= x4 && x <= x2));
- //Borders of The Upper Rectangle Without Internal Border:
- var onLeftSide2 = ((x == x3) && (y >= y3 && y <= y4));
- var onRightSide2 = ((x == x4) && (y >= y3 && y <= y4));
- var onTop2 = ((y == y4) && (x >= x3 && x <= x4));
- var internalBorder = ((y == y5) && (x > x5) && (x < x6));
- var insideRectang1 = ((x > x1) && (x < x2) && (y > y1) && (y < y2));
- var insideRectang2 = ((x > x3) && (x < x4) && (y > y3) && (y < y4));
- if (internalBorder || insideRectang1 || insideRectang2)
- {
- Console.WriteLine("inside");
- }
- else if (onLeftSide1 || onRightSide1 || onBottom1 || onTopLeft1 || onTopRight1 || onLeftSide2 || onRightSide2 || onTop2)
- {
- Console.WriteLine("border");
- }
- else
- {
- Console.WriteLine("outside");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement