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