Advertisement
Guest User

Untitled

a guest
Sep 1st, 2016
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 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 _12.Generate_Rectangles
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var n = int.Parse(Console.ReadLine());
  14. var m = int.Parse(Console.ReadLine());
  15. bool no = true;
  16. for (int left = - n; left <= n; left++)
  17. {
  18. for (int top = -n ; top <= n; top++)
  19. {
  20. for (int right = left + 1; right <= n; right++)
  21. {
  22. for (int bottom = top + 1; bottom <= n; bottom++)
  23. {
  24. var wight = right - left;
  25. var height = bottom - top;
  26. var area = wight * height;
  27. if (area >= m)
  28. {
  29. Console.WriteLine("({0}, {1}) ({2}, {3}) -> {4}",left ,top , right , bottom , area );
  30. no = false;
  31. }
  32.  
  33. }
  34. }
  35. }
  36. }
  37. if (no) Console.WriteLine("No");
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement