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