I solved the puzzle on python, but did not pass 2 tests out of 6, which are unknown. Please help, otherwise I don’t understand at all. Here is the condition:

  1. In one move, one of the two extreme grasshoppers (i.e., from tile A or from tile C) can jump over an average grasshopper (tile B) and stand on a tile that is exactly halfway between the two remaining grasshoppers (that is, between B and C or A and B respectively). If between the two remaining grasshoppers there is an even number of tiles, he can choose either of the two central tiles.

Input The program receives as input three integers A, B and C (1ABC1000), written in separate lines.

Output Output one number - the maximum number of moves that the game can continue.

Here is the code:

a = int(input()) b = int(input()) c = int(input()) l = (cb) + (ba) - 2 s = 0 while (l>0): s= s+1 l = l >> 1 print(s) 

Please tell me how to improve this solution.

  • Something I don’t see in the problem question - Alexey Ten
  • I apologize. Now I will add - Dmitry Anisimov
  • Uh? Fibonacci? It seems you have copied something wrong - Alexey Ten
  • Yes Yes. Already noticed. I apologize once again ... - Dmitry Anisimov
  • In the input given 1 <= a <b <c <100. Doesn't fit ... - Dmitry Anisimov

0