/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 328.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Accepted 3ms 332.0 KiB
#4 Accepted 2ms 584.0 KiB
#5 Accepted 3ms 540.0 KiB
#6 Accepted 4ms 544.0 KiB
#7 Wrong Answer 3ms 540.0 KiB
#8 Wrong Answer 4ms 344.0 KiB

Code

#include <iostream>
using namespace std;

typedef long long ll;

int musa(ll A, ll B) 
{
    int operations = 0;
    while (A != 0 && B != 0) 
    {
        if (A > B) 
        {
            operations += A / B;
            A %= B;
        }
        else 
        {
            operations += B / A;
            B %= A;
        }
    }
    return operations;
}

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

    while (T--) 
    {
        ll A, B;
        cin >> A >> B;
        cout << musa(A, B) << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1029 Make it zero
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-03 12:52:30
Judged At
2025-01-03 12:52:30
Judged By
Score
50
Total Time
4ms
Peak Memory
584.0 KiB