nicolepavlova386

14.Point in the Figure

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