Created
October 27, 2018 10:31
-
-
Save Retterath/f342074d7172e51f8c2b689fe8e4099d to your computer and use it in GitHub Desktop.
Train (not completed)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Train | |
{ | |
class Program | |
{ | |
static void Main() | |
{ | |
List<int> Wagons = Console.ReadLine() | |
.Split(' ') | |
.Select(int.Parse) | |
.ToList(); | |
int capacityOfEach = int.Parse(Console.ReadLine()); | |
while (true) | |
{ | |
string line = Console.ReadLine(); | |
string[] splittedLine = line.Split(); | |
string command = splittedLine[0]; | |
if (line == "end") | |
{ | |
break; | |
} | |
if (command == "Add") | |
{ | |
int numberToAdd = int.Parse(splittedLine[1]); | |
Wagons.Add(numberToAdd); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment