Advertisement
kzborisov

PointInTheFigure

Sep 24th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 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 Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int height = int.Parse(Console.ReadLine());
  14. int x = int.Parse(Console.ReadLine());
  15. int y = int.Parse(Console.ReadLine());
  16.  
  17. bool outRect1 = (x < 0 || x > 3 * height) || (y < 0 || y > height);
  18. bool outRect2 = (x < height || x > 2 * height) || (y < height || y > 4 * height);
  19.  
  20. bool inRect1 = (x > 0 && x < 3 * height) && (y > 0 && y < height);
  21. bool inRect2 = (x > height && x < 2 * height) && (y > height && y < 4 * height);
  22.  
  23. bool commonBorder = (x > height && x < 2 * height) && y == height;
  24.  
  25. if (outRect1 && outRect2)
  26. {
  27. Console.WriteLine("outside");
  28. }
  29. else if (inRect1 || inRect2 || commonBorder)
  30. {
  31. Console.WriteLine("inside");
  32. }
  33. else
  34. {
  35. Console.WriteLine("border");
  36. }
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement