Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int a,b,c,count=0;
- cin>>a>>b>>c;
- int d=0;
- if (b-a>c-b) {
- d=b-a;
- }else {
- d=c-b;
- }
- while (d!=1) {
- if (d%2==0) {
- d/=2;
- count++;
- }else {
- d=(d+1)/2;
- count++;
- }
- }
- cout<<count;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement