/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 512.0 KiB
#2 Accepted 77ms 576.0 KiB
#3 Time Exceeded ≥3033ms ≥536.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-10-03 14:06:26
Judged By
Score
50
Total Time
≥3033ms
Peak Memory
≥576.0 KiB