/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Accepted 78ms 568.0 KiB
#3 Time Exceeded ≥3024ms ≥540.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, lcd;
        cin >> a >> b;
        int mx = max(a, b);
        lcd = -1;
        for (int j = 2; j <= mx; j++)
        {
            if (a % j == 0 && b % j == 0)
            {
                lcd = j;
                break;
            }
        }
        cout << lcd << 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:56:08
Judged At
2024-11-11 03:46:30
Judged By
Score
50
Total Time
≥3024ms
Peak Memory
≥568.0 KiB