miroslavbstoyanov

Untitled

Jun 18th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 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 PointInFigure
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var h = int.Parse(Console.ReadLine());
  14. var x = int.Parse(Console.ReadLine());
  15. var y = int.Parse(Console.ReadLine());
  16.  
  17. var x1 = 0;
  18. var x2 = h * 3;
  19. var y1 = 0;
  20. var y2 = h;
  21. var x3 = h;
  22. var x4 = h * 2;
  23. var y3 = h;
  24. var y4 = 4 * h;
  25. bool borderR1 = ((x == x1 || x == x2) && (y >= y1 && y <= y2)) || ((y == y1 || y == y2) && (x >= x1 && x <= x2));
  26. bool borderR2 = ((x == x3 || x == x4 ) && (y >= y3 && y <= y4)) || ((y == y3 || y == y4) && (x >= x3 && x <= x4));
  27. bool border = borderR1 || borderR2;
  28.  
  29. bool rectangle1 = (x > x1 && x < x2) && (y > y1 && y < y2);
  30. bool rectangle2 = (x > x3 && x < x4) && (y > y3 && y < y4);
  31. bool inside = rectangle1 || rectangle2;
  32.  
  33. bool pointbetween = (y == h && (x > h && x < h * 2));
  34.  
  35. if (pointbetween)
  36. Console.WriteLine("inside");
  37. else if (border)
  38. Console.WriteLine("border");
  39. else if (inside)
  40. Console.WriteLine("inside");
  41. else
  42. Console.WriteLine("outside");
  43.  
  44.  
  45.  
  46.  
  47.  
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment