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 Problem_12.Test_Numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- int maxSumBoundary = Math.Abs(int.Parse(Console.ReadLine()));
- int sum = 0;
- int totalSum = sum;
- int totalCombinations = 0;
- for (int i = n; i >= 1; i--)
- {
- for (int j = 1; j <= m; j++)
- {
- sum = i * j * 3;
- totalSum += sum;
- totalCombinations++;
- if (totalSum >= maxSumBoundary)
- {
- Console.WriteLine($"{totalCombinations} combinations");
- Console.WriteLine($"Sum: {totalSum} >= {maxSumBoundary}");
- return;
- }
- }
- }
- Console.WriteLine($"{totalCombinations} combinations");
- Console.WriteLine($"Sum: {totalSum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment