Advertisement
koksibg

Point_In_The_Figure

Jun 28th, 2016
479
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Point_In_The_Figure
  8. {
  9.     class Point_In_The_Figure
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int h = int.Parse(Console.ReadLine());
  14.             int x = int.Parse(Console.ReadLine());
  15.             int y = int.Parse(Console.ReadLine());
  16.             int x1 = 0;      // first rectangle
  17.             int y1 = 0;      // first rectangle
  18.             int x2 = 3 * h;  // first rectangle
  19.             int y2 = h;      // first rectangle
  20.             int x3 = h;      // second rectangle
  21.             int y3 = h;      // second rectangle
  22.             int x4 = 2 * h;  // second rectangle
  23.             int y4 = 4 * h;  // second rectangle
  24.             if (((((x == x1) || (x == x2)) && (y1 <= y) && (y <= h)) || (((y == y1) || (y == h)) && (x1 <= x) && (x <= x2)) ||
  25.                (((x == h) || (x == x4)) && (h <= y) && (y <= y4)) || (((y == h) || (y == y4)) && (h <= x) && (x <= x4))) && (!((y == h) && (x > h) && (x < x4))))
  26.                 Console.WriteLine("border");
  27.             else if (((x >= x1) && (x <= x2) && (y >= y1) && (y <= h)) || ((x >= h) && (x <= x4) && (y >= h) && (y <= y4)) || (y == h) && (x > h) && (x < x4))
  28.                 Console.WriteLine("inside");
  29.             else Console.WriteLine("outside");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement