Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace КоледнаШапка
- {
- class Program
- {
- static void Main(string[] args)
- {
- var n = int.Parse(Console.ReadLine());
- var m = int.Parse(Console.ReadLine());
- var controlNum = int.Parse(Console.ReadLine());
- var counter = 0;
- var sum = 0;
- for (int first = 1; first <= n; first++)
- {
- for (int second = m; second >= 1; second--)
- {
- sum += first * 2 + second * 3;
- counter++;
- if (sum >= controlNum)
- {
- Console.WriteLine($"{counter} moves");
- Console.WriteLine($"Score: {sum} >= {controlNum}");
- return;
- }
- }
- }
- Console.WriteLine($"{counter} moves");
- }
- }
- }
- // Контролно число
- // 3
- // 4
- // 115
- // 10 moves
- // Score: 117 >= 115
Advertisement
Add Comment
Please, Sign In to add comment