/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 488.0 KiB
#2 Accepted 2ms 540.0 KiB
#3 Accepted 8ms 544.0 KiB
#4 Accepted 11ms 540.0 KiB
#5 Accepted 5ms 384.0 KiB
#6 Accepted 55ms 544.0 KiB
#7 Time Exceeded ≥1023ms ≥540.0 KiB
#8 Time Exceeded ≥1033ms ≥532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

long long sir(long long A, long long B) {
    long long op = 0;

    while (A != 0 && B != 0) {
        if (A > B) {
            A = abs(A - B);
        } else {
            B = abs(B - A);
        }
        op++;
    }

    return op;
}

int main() {
    int T;
    cin >> T;

    while (T--) {
        long long A, B;
        cin >> A >> B;

        long long ans = sir(A, B);
        cout << ans << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1029 Make it zero
Contest
Brain booster #2
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-06 14:23:25
Judged At
2024-11-11 03:41:59
Judged By
Score
50
Total Time
≥1033ms
Peak Memory
≥544.0 KiB