| CodeRams Practice Problem Archive |
|---|
| Finished |
A train station needs your help to maximize its efficiency. The train station can only have 100 train carts parked on a track at once, and it is imperative that the tracks are fully filled as to maximize profit. Given a list of trains and their lengths (number of train carts) print the pairs of trains that will most effectively fill the station.
You will be given 4 integers separated by spaces. Each of these integers represents the number of cars on a train.
Print the pairs of trains.
25 50 50 75
Train 1 and Train 4 Train 2 and Train 3
35 24 65 76
Train 1 and Train 3 Train 2 and Train 4
In the first case, Train 1 must be combined with Train 4, as 25 cars plus 75 cars adds up to 100 cars. Train 3 must be combined with Train 4, as 50 cars plus 50 cars equals 100 cars.
Also, assume that there is always a way to fill each track with 100 trains. Make sure the output format puts the trains in ascending order (i.e. Train 1 and Train 3, not Train 3 and Train 1).
| Name |
|---|


