/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 1ms 328.0 KiB
#4 Accepted 30ms 636.0 KiB
#5 Accepted 30ms 788.0 KiB

Code

/**
 *  written by Binoy Barman .
**/

#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
#define all(v) v.begin(), v.end()
#define Too_Many_Jobs int tts, tc = 1; cin >> tts; hell: while(tts--)
#define Dark_Lord_Binoy ios_base::sync_with_stdio(false); cin.tie(NULL);

#ifdef LOCAL
#include "unravel.hpp"
#else
#define dbg(...) 42
#endif
#define ll long long

int32_t main() {
Dark_Lord_Binoy
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    Too_Many_Jobs {
        ll a, b;
        cin >> a >> b;
        ll cnt = 0;
        while(1) {
            if(b / 2 < a) break;
            cnt++;
            if(b & 1) b--;
            else b /= 2;
        }
        cout << cnt + (b - a) << nl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1044 Add or multiple
Contest
TLE_Headquarters - round #1
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-27 16:24:50
Judged At
2024-11-11 03:38:56
Judged By
Score
100
Total Time
30ms
Peak Memory
788.0 KiB