Advertisement
Guest User

Untitled

a guest
Oct 18th, 2016
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 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. using System.Numerics;
  7.  
  8. namespace test
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int h = int.Parse(Console.ReadLine());
  15.             int x = int.Parse(Console.ReadLine());
  16.             int y = int.Parse(Console.ReadLine());
  17.  
  18.             var firstRectangle = (x > h && x < 2 * h && y >= h && y < 4 * h);
  19.             var secondRectangle = (x > 0 && x < 3 * h && y > 0 && y < h);
  20.  
  21.             var firstTop = (y == 4 * h && x >= h && x <= 2 * h);      //(y == 4*h && x >= h && x <= 2*h)
  22.             var firstLeft = (x == h && y >= h && y <= 4 * h);      //(x == h && y >= h && y <= 4*h )
  23.             var firstRight = (x == 2 * h && y >= h && y <= 4 * h);   //(x == 2*h && y >= h && y <= 4*h)
  24.             var secondUpLeft = (y == h && x >= 0 && x <= h);           //(y == h && x >= 0 && x <= h)
  25.             var secondUpRight = (y == h && x >= 2 * h && x <= 3 * h);   //(y == h && x >= 2*h && x <=3*h)
  26.             var secondLeft = (x == 0 && y >= 0 && y <= h);           //(x == 0 && y >=0 && y <= h )
  27.             var secondRight = (x == 3 * h && y >= 0 && y <= h);    //(x == 3*h && y <=h && y >=0)
  28.             var secondDown = (y == 0 && x >= 0 && x <= 3 * h);      //(y == 0 && x >= 0 && x <= 3*h)
  29.  
  30.  
  31.             if (firstRectangle|| secondRectangle)
  32.             {
  33.                 Console.WriteLine("inside");
  34.             }
  35.             else if (firstTop || firstLeft || firstRight || secondUpLeft || secondUpRight || secondLeft || secondRight || secondDown)
  36.             {
  37.                 Console.WriteLine("border");
  38.             }
  39.             else
  40.             {
  41.                 Console.WriteLine("outside");
  42.             }
  43.  
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement