Flipping Frustration [HELP]

Revision en3, by Aritra741, 2019-08-14 06:45:56

The problem goes like this: You have a book with n ( n<=10^7 ) pages. You can flip exactly X pages to the right and exactly Y pages to the left. If you're initially on page 1, what is the minimum number of moves to go from page 1 to page A? (**100 test cases**)

You can find the problem Here( UVA 11312- Flipping Frustration ).

I will be very thankful if you provide me with a solution.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English Aritra741 2019-08-15 07:37:01 0 Tiny change: 'st cases**)\n\nYou ca' -> 'st cases**\n\nYou ca'
en4 English Aritra741 2019-08-14 06:46:44 0 Tiny change: '0 test cases**)\n\nYo' -> '0 test cas**)\n\nYo'
en3 English Aritra741 2019-08-14 06:45:56 21 Tiny change: 'to page A?\n\nYou ca' -> 'to page A? (**100 test cases**)\n\nYou ca'
en2 English Aritra741 2019-08-14 05:42:40 1 Tiny change: 'Th problem g' -> 'The problem g'
en1 English Aritra741 2019-08-14 05:39:59 505 Initial revision (published)