Guest User

Untitled

a guest
Oct 8th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Problem_12.Test_Numbers
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. int m = int.Parse(Console.ReadLine());
  15. int maxSumBoundary = Math.Abs(int.Parse(Console.ReadLine()));
  16.  
  17. int sum = 0;
  18. int totalSum = sum;
  19. int totalCombinations = 0;
  20.  
  21. for (int i = n; i >= 1; i--)
  22. {
  23. for (int j = 1; j <= m; j++)
  24. {
  25. sum = i * j * 3;
  26. totalSum += sum;
  27. totalCombinations++;
  28. if (totalSum >= maxSumBoundary)
  29. {
  30. Console.WriteLine($"{totalCombinations} combinations");
  31. Console.WriteLine($"Sum: {totalSum} >= {maxSumBoundary}");
  32. return;
  33. }
  34. }
  35. }
  36. Console.WriteLine($"{totalCombinations} combinations");
  37. Console.WriteLine($"Sum: {totalSum}");
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment