Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _12._Test_Numbers
- {
- 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 totalSum = 0;
- int count = 0;
- for (int i = n; i >= 1; i--)
- {
- for (int h = 1; h <= m; h++)
- {
- totalSum += (i * h) * 3;
- count++;
- if (totalSum >= maxSum)
- {
- Console.WriteLine($"{count} combinations");
- Console.WriteLine($"Sum: {totalSum} >= {maxSum}");
- return;
- }
- }
- }
- Console.WriteLine($"{count} combinations");
- Console.WriteLine($"Sum: {totalSum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment