Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 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 = left + 1; right <= n; right++)
  18.                 {
  19.                     for (var bottom = top + 1; bottom <= n; bottom++)
  20.                     {
  21.                         var width = right - left;
  22.                         var height = bottom - top;
  23.                         var area = width * height;
  24.                         if (area >= minArea)
  25.                         {
  26.                             Console.WriteLine("({0}, {1}) ({2}, {3}) -> {4}", left, top, right, bottom, area);
  27.                             PrintNo = false;
  28.                         }
  29.                     }
  30.                 }
  31.             }
  32.         }
  33.         if (PrintNo) { Console.WriteLine("No"); }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement