-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path520B.cpp
More file actions
52 lines (48 loc) · 943 Bytes
/
520B.cpp
File metadata and controls
52 lines (48 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#include <string>
#include <streambuf>
#include <fstream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <map>
#include <set>
#include <stdlib.h>
#include <cstdio>
#include <vector>
#include <queue>
#include <utility>
#include <math.h>
using namespace std;
#define pi acos(-1.0)
#define N 1000000
#define ll long long
using namespace std;
vector < ll > cell;
int main()
{
ll x,y,a,b,n,m,e,t;
scanf("%lld %lld",&n,&m);
if(m<n)
{
printf("%lld\n",n-m);
}
else
{
t=0;
while(n<m)
{
if(m%2==0)
m/=2;
else
m++;
t++;
}
// cout << t << " " << n << " " << m << endl;
printf("%lld\n",t+n-m);
}
return 0;
}