/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 352.0 KiB
#2 Accepted 2ms 772.0 KiB
#3 Accepted 16ms 564.0 KiB
#4 Accepted 15ms 564.0 KiB
#5 Accepted 4ms 512.0 KiB
#6 Accepted 197ms 564.0 KiB
#7 Time Exceeded ≥1037ms ≥332.0 KiB
#8 Time Exceeded ≥1033ms ≥512.0 KiB

Code

/**
*	author: shafi
*	created: 06.03.2024 17.12.19
**/
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define ull unsigned long long int

int main(){
    ios :: sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int tc;
    cin>>tc;
    while(tc--){
        ll a,b;
        cin>>a>>b;
        if(b>a) swap(a,b);
        ll cnt = 0;
        while(true){
            a = a-b;
            cnt++;
            if(b>a)swap(a,b);
            if(a<=0 || b <= 0) break;
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Information

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