Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P12TestNumbers
- {
- 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 countOfComb = 0;
- double result = 0.0;
- for (int i = n; i >= 1; i--)
- {
- for (int j = 1; j <= m; j++)
- {
- if (result >= boundary)
- {
- break;
- }
- result += (i * j) * 3;
- countOfComb++;
- }
- }
- if (result >= boundary)
- {
- Console.WriteLine($"{countOfComb} combinations");
- Console.WriteLine($"Sum: {result} >= {boundary}");
- }
- else
- {
- Console.WriteLine($"{countOfComb} combinations");
- Console.WriteLine($"Sum: {result}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment