Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _13_PointInTheFigure
- {
- class Program
- {
- static void Main(string[] args)
- {
- var side = int.Parse(Console.ReadLine());
- var x = int.Parse(Console.ReadLine());
- var y = int.Parse(Console.ReadLine());
- // upper right coordinates are 2x, 4y
- bool OutRectangle1 = ((x > 3 * side) || x < 0) || (y > side || y < 0);
- bool OutRectangle2 = ((x > 2 * side) || x < side) || (y > 4 * side || y < 0);
- bool InRectangle1 = ((x < 3 * side) && x > 0) && (y < side && y > 0);
- bool InRectangle2 = ((x < 2 * side) && x > side) && (y < 4 * side && y > side);
- bool CommonBorder = ((x < 2 * side) && x > side) && y == side;
- if ( OutRectangle1 && OutRectangle2 )
- { Console.WriteLine("Outside"); }
- else if ( InRectangle1 || InRectangle2 || CommonBorder)
- { Console.WriteLine("Inside"); }
- else { Console.WriteLine("Border"); }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement