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_Numbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int m = int.Parse(Console.ReadLine());
- int stop = int.Parse(Console.ReadLine());
- int combinationsSum = 0;
- int count = 0;
- bool isNumber = false;
- for (int i = n; i >=1; i--)
- {
- for (int k = 1; k <= m; k++)
- {
- combinationsSum += + 3 * (i * k);
- count++;
- if (combinationsSum >= stop)
- {
- isNumber = true;
- Console.WriteLine($"{count} combinations");
- Console.WriteLine($"Sum: {combinationsSum} >= {stop}");
- return;
- }
- }
- }
- if (!isNumber)
- {
- Console.WriteLine($"{count} combinations");
- Console.WriteLine($"Sum: {combinationsSum}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement