/ SeriousOJ /

Record Detail

Accepted


  

Code

#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+10,MOD=1000000007;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    cin>>t;
    while(t--){
    int a,b;
    cin>>a>>b;
    int gd=__gcd(a,b);
    if(gd==1){
        cout<<-1<<"\n";
        continue;
    }
    for(int i=2;i*i<=gd;i++){
          if(gd%i==0){
           gd=i;
           break;
          }
    }
    cout<<gd<<"\n";

   
     
     
 }


    
    return 0;
 
}

Information

Submit By
Type
Pretest
Problem
P1011 LCD
Language
C++20 (G++ 13.2.0)
Submit At
2024-01-05 16:03:38
Judged At
2024-11-11 03:44:19
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes