Time Exceeded
Code
#include<bits/stdc++.h>
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ll long long int
using namespace std;
void solution();
int main() {
faster
int t = 1;
cin >> t;
while (t--) {
solution();
}
}
void solution() {
int x, y;
cin >> x >> y;
int op = 0;
if(x==y)
cout << 0 << endl;
else if(y%2==0){
while (x!=y) {
x=x*2;
op++;
}
cout << op << endl;
}
else{
cout << y/2 << endl;
}
}
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:18:42
- Judged At
- 2024-11-11 03:37:39
- Judged By
- Score
- 20
- Total Time
- ≥2071ms
- Peak Memory
- ≥540.0 KiB