Time Exceeded
Code
#include<iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,m,flag=1;
cin>>n>>m;
for(int i=2 ;i<=n; i++){
if(n%i==0 &&m%i==0){
cout<<i<<endl;
flag=0;
break;
}
}
if(flag){
cout<<-1<<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 15:34:32
- Judged At
- 2024-11-11 03:45:36
- Judged By
- Score
- 50
- Total Time
- ≥3099ms
- Peak Memory
- ≥788.0 KiB