Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. namespace CamelBack
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6.  
  7. public class Program
  8. {
  9. public static void Main()
  10. {
  11. List<int> buildings = Console.ReadLine()
  12. .Split(' ').Select(int.Parse).ToList();
  13. int camelBackLenght = int.Parse(Console.ReadLine());
  14.  
  15. int rounds = 0;
  16.  
  17. while (camelBackLenght < buildings.Count)
  18. {
  19. buildings.RemoveAt(buildings.Count - 1);
  20. buildings.RemoveAt(0);
  21. rounds++;
  22. }
  23.  
  24. if (rounds == 0)
  25. {
  26. Console.Write("already stable: ");
  27. Console.WriteLine(string.Join(" ", buildings));
  28. }
  29. else
  30. {
  31. Console.WriteLine($"{rounds} rounds");
  32. Console.Write("remaining: ");
  33. Console.WriteLine(string.Join(" ", buildings));
  34.  
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement