/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n,m,i,ctr=0;
        cin >> n >> m;
        for(i=2; i<=n; i++)
        {
            if(n%i==0 && m%i==0)
            {
                ctr++;
                break;
            }
        }
        if(ctr==0)
            cout << -1 << endl;
        else
            cout << i << endl;
    }
    return 0;
}

Information

Submit By
Type
Pretest
Problem
P1011 LCD
Language
C++20 (G++ 13.2.0)
Submit At
2024-05-02 13:27:16
Judged At
2024-05-02 13:27:16
Judged By
Score
0
Total Time
1ms
Peak Memory
540.0 KiB