Bus Ho Gaya
All submissions for this problem are available.
Vatsal and Dipen met at Vikrant Circle after a long time. Vatsal stays at Chembur and Dipen at Kurla. Both of them commute by bus. They reached the bus stop, and got to know that both their buses had left just then (at the same time) for the respective destinations. Neither wanted to leave the other alone at the bus stop. They came to know that a bus arrives every x min for Chembur and every y min for Kurla. They want to leave together only. Can you help them find out how many buses they have to leave i.e not board?
- The first line will contain T, no of test cases
- Each testcase consists of one line with two space seperated integers - X , frequency of the bus to Chembur and Y, frequency of the bus to Kurla
On a new line for eact testcase, print M, the number of buses Vatsal leaves and N, the number of buses Dipen leaves.
- 1<=N, M<=10000
The 6th bus to Chembur and 5th Bus to Kurla's Arrivals will coincide at the 30th Minute. Hence they have to leave 5 buses and 4 buses respectively.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions