Advertisement
Guest User

Untitled

a guest
Apr 20th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2. using System.Runtime.InteropServices;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. int n = int.Parse(Console.ReadLine());
  9. int minArea = int.Parse(Console.ReadLine());
  10.  
  11. var PrintNo = true;
  12.  
  13. for (var left = -n; left <= n; left++)
  14. {
  15. for (var top = -n; top <= n; top++)
  16. {
  17. for (var right = top + 1; right <= n; right++)
  18.  
  19. {
  20. for (var bottom = left + 1; bottom <= n; bottom++)
  21. {
  22. var width = bottom - left;
  23. var height = right - top;
  24. var area = width * height;
  25. if (area >= minArea)
  26. {
  27. Console.WriteLine("({0}, {1}) ({2}, {3}) -> {4}", left, top, bottom, right, area);
  28. PrintNo = false;
  29. }
  30. }
  31. }
  32. }
  33. }
  34. if (PrintNo) { Console.WriteLine("No"); }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement