AGPC01B – Too Late Solution

SPOJ Solution

AGPC01B Statement

It’s exam day and as usual Halum is running late. He has only T minutes to go the the exam hall before it starts. There are two types of transports to go to the University. He can go via Bus which takes B minutes or he can take a CNG which takes C minutes. If he can reach the hall by Bus or CNG in time, he will always choose the Bus. As a lazy guy Halum doesn’t like to walk but if he can’t reach the university by Bus or CNG in time he will try walking. It takes W minutes to go to the university if he walks. Walking is sometimes faster than Bus or CNG because of heavy traffic. Even then if it’s impossible to reach the exam hall by any of the described ways he’ll just miss the exam.

Now, given T, B, C and W, you will have to find out which transport Halum should take to go to the university or tell us if he’s too late.


In the first line of input there will be four integers T B C W (1<=T, B, C, W<= 100).


Output one line describing the answer to the question. If he can go via Bus print “Bus”, if he can go via CNG print “CNG”, if those fails but he can go by foot print “Walk”. If it’s impossible to reach in time print “Too Late”. All output should be without the quotes. See sample input output for clarification.

AGPC01B Solution

You also like to see:


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.