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)
- {
- // 04:49 - 05:26
- 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 num1 = 0; num1 >= -n; num1--)
- {
- for (int num2 = 0; num2 >= -n; num2--)
- {
- for (int num3 = 0; num3 <= n; num3++)
- {
- for (int num4 = 0; num4 <= n; num4++)
- {
- //areaRectangle = Math.Abs(num3 - num1) * Math.Abs(num4 - num2);
- areaRectangle = (num3 - num1) *(num4 - num2);
- if (areaRectangle >= m)
- {
- Console.Write("({0}, {1}) ({2}, {3}) -> {4}",
- num1, num2, num3, num4, areaRectangle);
- Console.WriteLine();
- cnt++;
- }
- }
- }
- }
- }
- if (cnt == 0)
- {
- Console.WriteLine("No");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement