Advertisement
braveheart1989

Point_In_The_Figure

Apr 7th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 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 _11.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().ToLower());
  14.             double xPoint = double.Parse(Console.ReadLine().ToLower());
  15.             double yPoint = double.Parse(Console.ReadLine().ToLower());
  16.  
  17.             bool isInside = (xPoint < 3 * h && xPoint > 0 && yPoint > 0 && yPoint < h)
  18.                 || (xPoint > h && xPoint < 2 * h && yPoint > 0 && yPoint < 4 * h);
  19.  
  20.  
  21.             bool isBorder = ((xPoint == 0 && yPoint == 0) || (xPoint == 0 && yPoint <= h && yPoint >= 0)
  22.                 || (xPoint <= h && xPoint >= 0 && yPoint == h) || (xPoint == h && yPoint <= 4 * h && yPoint >= 0)
  23.                 || (xPoint >= h && xPoint <= 2 * h && yPoint <= 4 * h && yPoint >= 0) || (xPoint >= 2 * h && xPoint <= 3 * h && yPoint == h) || (xPoint == h && yPoint == 0)||(xPoint <= h && xPoint>=0 && yPoint >= 0 && yPoint<=h)||(xPoint>= 2*h && xPoint <= 3*h && yPoint >= 0 && yPoint<=h));
  24.  
  25.             if (isInside)
  26.             {
  27.                 Console.WriteLine("inside");
  28.             }
  29.             else if (isBorder)
  30.             {
  31.                 Console.WriteLine("border");
  32.             }
  33.             else
  34.             {
  35.                 Console.WriteLine("outside");
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement