407084: GYM102697 055 Train-ficiency

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

055. Train-ficiencytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

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.

Input

You will be given 4 integers separated by spaces. Each of these integers represents the number of cars on a train.

Output

Print the pairs of trains.

ExamplesInput
25 50 50 75
Output
Train 1 and Train 4
Train 2 and Train 3
Input
35 24 65 76
Output
Train 1 and Train 3
Train 2 and Train 4
Note

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).

加入题单

上一题 下一题 算法标签: