Untitled

mail@pastecode.io avatar
unknown
python
6 months ago
474 B
3
Indexable
Never
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)