Advertisement
NikolaySpasovTriset

PointInFigure

Oct 6th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.47 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         int h = int.Parse(Console.ReadLine());
  8.         int x = int.Parse(Console.ReadLine());
  9.         int y = int.Parse(Console.ReadLine());
  10.         int x1 = 3 * h;
  11.         int y1 = h;
  12.  
  13.         if (x >= 0 && x <= x1 && y == 0)
  14.         {
  15.             Console.WriteLine("border");
  16.         }
  17.         else if (y > 0 && y <= h && x == 0)
  18.         {
  19.             Console.WriteLine("border");
  20.         }
  21.         else if (y == h && x >= 0 && x >= 2 * h && x <= x1)
  22.         {
  23.             Console.WriteLine("border");
  24.         }
  25.         else if (y == h && x >= 0 && x < h)
  26.         {
  27.             Console.WriteLine("border");
  28.         }
  29.         else if (x == x1 && y >= 0 && y <= h)
  30.         {
  31.             Console.WriteLine("border");
  32.         }
  33.         else if (x == h && y >= h && y <= 4 * h)
  34.         {
  35.             Console.WriteLine("border");
  36.         }
  37.         else if (x == 2 * h && y >= h && y <= 4 * h)
  38.         {
  39.             Console.WriteLine("border");
  40.         }
  41.         else if (x >= h && x <= 2 * h && y == 4 * h)
  42.         {
  43.             Console.WriteLine("border");
  44.         }
  45.  
  46.         else if (x > 0 && x < x1 && y > 0 && y < h)
  47.         {
  48.             Console.WriteLine("inside");
  49.         }
  50.         else if (x > h && x < 2 * h && y < 4 * h && y > 0)
  51.         {
  52.             Console.WriteLine("inside");
  53.         }
  54.         else
  55.         {
  56.             Console.WriteLine("outside");
  57.         }    
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement