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)
- {
- int h = int.Parse(Console.ReadLine());
- int x = int.Parse(Console.ReadLine());
- int y = int.Parse(Console.ReadLine());
- //point inside
- bool first = ((x < 3 * h) && (x > 0) && (y < h)) && (y > 0);
- bool second = ((x > h) && (x < 2 * h) && (y == h));
- bool third = ((x > h) && (x < 2 * h) && (y > h) && (y < 4 * h));
- //point on a border
- bool a = (x == 0) && (y >= 0) && ((y < h) || (y == h));
- bool b = (y == 0) && ((x == 3 * h) || (x < 3 * h));
- bool c = (y == h) && ((x < 3 * h) || (x == 3 * h))&&((x==2*h)||(x>2*h));
- bool d = (x == 3 * h) && (y >= 0) && ((y < h) || (y == h));
- bool e = (y == h) && ((x > 0) || (x == 0)) && ((x < h) || (x == h));
- bool f = (y == 4 * h) && ((x == h) || (x > h)) && ((x < 2 * h) || (x == 2 * h));
- bool g = (x == h) && ((y > h) || (y == h)) && ((y < 4 * h) || (y == 4 * h));
- bool i = (x == 2 * h) && ((y == h) || (y > h)) && ((y < 4 * h) || (y == 4 * h));
- if ((x < 0) || (y < 0))
- {
- Console.WriteLine("outside");
- }
- else if ( first==true||second==true || third==true)
- {
- Console.WriteLine("inside");
- }
- else if (a == true || b == true || c == true || d == true || e == true || f == true || g == true || i == true)
- {
- Console.WriteLine("border");
- }
- else
- {
- Console.WriteLine("outside");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment