Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _12GenerateRectangles
- {
- class GenerateRectangle
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- bool printNo = true;
- for (int left = -n; left <= n; left++)
- {
- for (int top = -n; top <= n; top++)
- {
- for (int botton = top + 1; botton <= n; botton++)
- {
- for (int right = left + 1; right <= n; right++)
- {
- int width = right - left;
- int height = botton - top;
- int area = width * height;
- if (area >= m)
- {
- Console.WriteLine("({0}, {1}) ({2}, {3}) -> {4}", left, top, right, botton, area);
- printNo = false;
- }
- }
- }
- }
- }
- if (printNo)
- {
- Console.WriteLine("No");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement