/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 63ms 572.0 KiB
#3 Accepted 27ms 564.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;
        cin >> a >> b;
        int mx = max(a, b);
        int lcd = -1;
        for (int j = 2; j <= a*b; 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:59:24
Judged At
2024-11-11 03:46:30
Judged By
Score
100
Total Time
63ms
Peak Memory
572.0 KiB