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 Test
- {
- class Program
- {
- static void Main(string[] args)
- {
- int firstNum = int.Parse(Console.ReadLine());
- int secondNum = int.Parse(Console.ReadLine());
- int max = int.Parse(Console.ReadLine());
- int result = 0;
- int counter = 0;
- for (int i = firstNum; i >= 1; i--)
- {
- for (int j = 1; j <= secondNum; j++)
- {
- counter++;
- result = result + ((i * j) * 3);
- if (result >= max)
- {
- break;
- }
- }
- if (result >= max)
- {
- break;
- }
- }
- if (result >= max)
- {
- Console.WriteLine($"{counter} combinations");
- Console.WriteLine($"Sum: {result} >= {max}");
- }
- else
- {
- Console.WriteLine($"{counter} combinations");
- Console.WriteLine($"Sum: {result}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement