Accepted
Code
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.hpp"
#else
#define bug(...)
#endif
typedef long long ll;
#define endl "\n"
#define ws " "
#define yy cout<<"YES\n";
#define nn cout<<"NO\n";
signed main(){
int tc=0, tcMax=1;
cin >> tcMax;
while (tc++<tcMax) {
// bug(tc);
int a,b;
cin>>a>>b;
int count = 0;
while(1){
if(b%2){
// bug(b);
count++;
}
b/=2;
if(b<a){
// bug(b);
b*=2;
count+=b-a;
// bug(count);
break;
}else{
// bug(a,b);
count++;
// bug(count);
}
// bug(b);
}
cout<<count<<endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1044 Add or multiple
- Contest
- TLE_Headquarters - round #1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-03-27 17:43:44
- Judged At
- 2024-11-11 03:37:28
- Judged By
- Score
- 100
- Total Time
- 236ms
- Peak Memory
- 792.0 KiB