daily pastebin goal
96%
SHARE
TWEET

hui 2.0

a guest Jan 23rd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def f():
  2.     s = input().split(' ')
  3.     x = int(s[0])  
  4.     y = int(s[1])
  5.     res = 0
  6.     while y != x and res < 101:
  7.         if abs(y - x - 3) >= abs(y - 4*x):
  8.             if (x + 12 == x * 4) or x*4 == y:
  9.                 x*=4
  10.             else:
  11.                 x+=3
  12.         else:
  13.             x+=3
  14.         res+=1
  15.         if res == 101:
  16.             print(-1)
  17.     if res < 101:
  18.         print(res)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top