Untitled

 avatar
unknown
python
a year ago
474 B
4
Indexable
def min_moves(h, w, h1, w1):
    folds = 0
    
    while h != h1:
        if h1 > h / 2:
            folds += 1
            h = h1
        else:
            h /= 2
            folds += 1
    
    while w != w1:
        if w1 > w / 2:
            folds += 1
            w = w1
        else:
            w /= 2
            folds += 1
    
    return folds

h = int(input())
w = int(input())
h1 = int(input())
w1 = int(input())

result = min_moves(h, w, h1, w1)
print(result)
Editor is loading...