Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _12.TestNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- int maxSum = int.Parse(Console.ReadLine());
- int count = 0;
- int sum = 0;
- for (int i = n; i >= 1; i--)
- {
- for (int j = 1; j <= m; j++)
- {
- if (sum >= maxSum)
- {
- Console.WriteLine($"{count} combinations");
- Console.WriteLine($"Sum: {sum} >= {maxSum}");
- return;
- }
- else
- {
- count++;
- sum += 3 * (i * j);
- }
- }
- }
- Console.WriteLine($"{count} combinations");
- Console.WriteLine($"Sum: {sum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement