Advertisement
Guest User

Untitled

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