Guest User

Untitled

a guest
Sep 20th, 2017
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 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 ConsoleApplication96
  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 total = int.Parse(Console.ReadLine());
  16.             int counts = 0;
  17.             int result = 0;
  18.             for (int i = 1; i <= n; i++)
  19.             {
  20.                 for (int j = m; j >= 1; j--)
  21.                 {
  22.                     result += i * 2 + j * 3;
  23.                     counts++;
  24.                    
  25.                     if (result >= total)
  26.                     {
  27.                        
  28.                         break;
  29.                     }
  30.                 }
  31.                 if (result >= total)
  32.                 {
  33.                    
  34.                     break;
  35.                 }
  36.             }
  37.             if (result<total)
  38.             {
  39.                 Console.WriteLine($"{counts} moves");
  40.             }
  41.            else
  42.             {
  43.                 Console.WriteLine($"{counts} moves");
  44.                 Console.WriteLine($"Score: {result} >= {total}");
  45.                
  46.             }
  47.  
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment