Aliendreamer

camel list

Jun 26th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 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 _03ListsMoreExcercisesCamelBack
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             List<int> camel = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  15.  
  16.             int n = int.Parse(Console.ReadLine());
  17.  
  18.             int difference = camel.Count - n;
  19.  
  20.             if(difference<=0)
  21.             {
  22.                 Console.WriteLine("already stable: {0}",string.Join(" ",camel));
  23.  
  24.  
  25.             }
  26.             else
  27.             {
  28.  
  29.                 Console.WriteLine("{0} rounds {1}remaining: {2}",difference/ 2,Environment.NewLine,string.Join(" ",camel.GetRange(difference/2,n)));
  30.  
  31.  
  32.  
  33.             }
  34.  
  35.  
  36.  
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment