CF-520B

 avatar
kaziamir
c_cpp
a year ago
292 B
1
Indexable
Never
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,m;
    cin>>n>>m;
    if(m<n){
        cout<<n-m<<endl;
    }
    else{
        int ct =0;
        while(m<n){
            m*=2;
            ct++;
        }
        ct+=(m-n);
        cout<<ct<<endl;
    }

    return 0;
}