I have been trying this problem for some days.The problem is
My solution is http://www.codechef.com/viewsolution/2713870.
Approach:
For a fraction a/b, the largest fraction which can be subtracted is 1/ceil(b/a).(Greedy approach)
k=ceil(b/a)
The new fraction a’/b’=(kXa-b)/(kXb)
Am I wrong with this approach?