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 Control_Number
- {
- class Program
- {
- static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- int M = int.Parse(Console.ReadLine());
- int controlNumber = int.Parse(Console.ReadLine());
- int movesCounter = 0;
- int sum = 0;
- bool isEqual = false;
- for (int i = 1; i <= N; i++)
- {
- if (isEqual == true)
- {
- break;
- }
- for (int j = M; j >= 1; j--)
- {
- sum += i * 2 + j * 3;
- movesCounter++;
- if (controlNumber <= sum)
- {
- Console.WriteLine("{0} moves", movesCounter);
- Console.WriteLine("Score: {0} >= {1}", sum, controlNumber);
- isEqual = true;
- break;
- }
- }
- }
- if (isEqual==false)
- {
- Console.WriteLine("{0} moves", movesCounter);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement