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 Exercise_12_Generate_rectan
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- int areaRectangle;
- int cnt = 0;
- if (n < 1)
- {
- Console.WriteLine("No");
- return;
- }
- for (int x1 = -n; x1 <= n; x1++)
- {
- for (int y1 = -n; y1 <= n; y1++)
- {
- for (int x2 = x1+1; x2 <= n; x2++)
- {
- for (int y2 = y1+1; y2 <= n; y2++)
- {
- areaRectangle = (x2 - x1) * (y2 - y1);
- if (areaRectangle >= m)
- {
- Console.Write("({0}, {1}) ({2}, {3}) -> {4}",
- x1, y1, x2, y2, areaRectangle);
- Console.WriteLine();
- cnt++;
- }
- }
- }
- }
- }
- if (cnt == 0)
- {
- Console.WriteLine("No");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement