Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _12.GenerateRectangles
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             var n = int.Parse(Console.ReadLine());
  10.             var m = int.Parse(Console.ReadLine());
  11.             if (4 * n * n >= m)
  12.             {
  13.                 for (int x1 = -n; x1 <= n; x1++)
  14.                 {
  15.                     for (int y1 = -n; y1 <= n; y1++)
  16.                     {
  17.                         for (int x2 = -n; x2 <= n; x2++)
  18.                         {
  19.                             for (int y2 = -n; y2 <= n; y2++)
  20.                             {
  21.                                 if (x1 < x2 && y1 < y2)
  22.                                 {
  23.                                     if ((x2 - x1) * (y2 - y1) >= m)
  24.                                         Console.WriteLine("({0}, {1}) ({2}, {3}) -> {4}",
  25.                                             x1, y1, x2, y2, (x2 - x1) * (y2 - y1));
  26.                                 }
  27.                             }
  28.                         }
  29.                     }
  30.                 }
  31.             }
  32.             else
  33.                 Console.WriteLine("No");
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement