Time Exceeded
Code
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
void solve(){
int n, m;
cin>>n>>m;
int mn = min(n, m);
for(int i=2;i<=mn;i++){
if(n%i==0 && m%i==0){
cout<<i<<endl;
return;
}
}
cout<<-1<<endl;
}
int main(){
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1011 LCD
- Contest
- Brain booster - 1
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2023-12-31 15:08:44
- Judged At
- 2024-11-11 03:45:57
- Judged By
- Score
- 50
- Total Time
- ≥3059ms
- Peak Memory
- ≥564.0 KiB