Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 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 _06.Control
  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 control = int.Parse(Console.ReadLine());
  16.             int sum = 0;
  17.             int counter = 0;
  18.             for (int i = 1; i <=N ; i++)
  19.             {
  20.                 for (int j = M; j >= 1; j--)
  21.                 {
  22.                     counter++;
  23.                     sum =  sum + N * 2 + M * 3;
  24.                    
  25.                     if ( sum >= control)
  26.                     {
  27.                         Console.WriteLine("{0} moves", counter);
  28.                         Console.WriteLine("Score: {0} >= {1}", sum, control);
  29.                         return;
  30.                     }
  31.                     else if (sum < control)
  32.                     {
  33.                         Console.WriteLine("{0} moves", counter);
  34.                         return;
  35.                     }
  36.                 }
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement