Advertisement
EmoRz

Point in the Figure

Jul 8th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Point
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int h = int.Parse(Console.ReadLine());
  10.             int x = int.Parse(Console.ReadLine());
  11.             int y = int.Parse(Console.ReadLine());
  12.  
  13.             var outRect1 = (x < 0 || x > 3 * h) || (y < 0 || y > h);
  14.             var outRect2 = (x < h || x > 2 * h) || (y < h || y > 4 * h);
  15.  
  16.             var inRect1 = (x > 0 && x < 3 * h) && (y > 0 && y < h);
  17.             var inRect2 = (x > h && x < 2 * h) && (y > h && y < 4 * h);
  18.  
  19.             var border = (x > h && x < 2 * h) && y == h;
  20.  
  21.             if (outRect1 && outRect2)
  22.             {
  23.                 Console.WriteLine("outside");
  24.             }
  25.             else if (inRect1 || inRect2 || border)
  26.             {
  27.                 Console.WriteLine("inside");
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine("border");
  32.             }
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement