kema

Point In The Figure

Feb 29th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2. class PointInTheFigure
  3. {
  4.     static void Main(string[] args)
  5.     {
  6.         int h = int.Parse(Console.ReadLine());
  7.         int pointX = int.Parse(Console.ReadLine());
  8.         int pointY = int.Parse(Console.ReadLine());
  9.         int x1 = 0;
  10.         int y1 = 0;
  11.         int x2 = 3 * h;
  12.         int y2 = h;
  13.         int secX1 = h;
  14.         int secY1 = 0;
  15.         int secX2 = h * 2;
  16.         int secY2 = h * 4;
  17.         if ((pointX > x1 && pointX < x2) &&
  18.             (pointY > y1 && pointY < y2) ||
  19.             (pointX > secX1 && pointX < secX2) &&
  20.             (pointY > secY1 && pointY < secY2))
  21.         {
  22.             Console.WriteLine("inside");
  23.         }
  24.         else if ((pointX < x1 || pointX > x2) ||
  25.                 (pointY < y1 || pointY > y2) &&
  26.                 (pointX < secX1 || pointX > secX2) ||
  27.                 (pointY < secY1 || pointY > secY2))
  28.         {
  29.             Console.WriteLine("outside");
  30.         }
  31.         else
  32.         {
  33.             Console.WriteLine("border");
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment