/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 2ms 644.0 KiB
#3 Accepted 8ms 544.0 KiB
#4 Accepted 17ms 548.0 KiB
#5 Accepted 5ms 540.0 KiB
#6 Accepted 56ms 548.0 KiB
#7 Wrong Answer 145ms 536.0 KiB
#8 Time Exceeded ≥1012ms ≥540.0 KiB

Code

#include <iostream>
#include <cmath>
using namespace std;
int main() {
    
    //SAYED AL MAMUN_LU
    
    int t;
    cin >> t;

    while (t--) {
        int a, b, sum = 0;
        cin >> a >> b;

        while (a > 0 && b > 0) {
            if (a > b) {
                a = abs(a - b);
            } 
            else {
                b = abs(a - b);
            }
            sum++;
        }

        cout << sum << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1029 Make it zero
Contest
Brain booster #2
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-06 16:31:46
Judged At
2024-11-11 03:41:19
Judged By
Score
50
Total Time
≥1012ms
Peak Memory
≥644.0 KiB