/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Time Exceeded ≥3058ms ≥532.0 KiB
#2 Accepted 50ms 564.0 KiB
#3 Time Exceeded ≥3073ms ≥324.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++)
    {
        int a, b, n, lcd=0;
        cin >> a >> b;
        n = 2;
        while (1)
        {
            if ((a % n == 0) && (b % n == 0))
            {
                lcd = n;
                break;
            }
            ++n;
        }
        if (lcd != 0)
        {
            cout << lcd << endl;
        }
        else cout<<"-1"<<endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1011 LCD
Contest
Brain booster - 1
Language
C++20 (G++ 13.2.0)
Submit At
2023-12-31 13:44:36
Judged At
2024-10-03 14:06:31
Judged By
Score
40
Total Time
≥3073ms
Peak Memory
≥564.0 KiB