Time Exceeded
Code
#include <stdio.h>
int main() {
int t;
scanf("%d",&t);
while(t--){
int n,m;
scanf("%d %d",&n,&m);
int lcd=-1;
int i=2;
while (i<=n && i<=m){
if (n%i==0 && m%i==0){
lcd=i;
break;
}
i++;
}
printf("%d\n", lcd);
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1011 LCD
- Contest
- Brain booster - 1
- Language
- C11 (GCC 13.2.0)
- Submit At
- 2023-12-31 16:22:37
- Judged At
- 2024-11-11 03:45:12
- Judged By
- Score
- 50
- Total Time
- ≥3081ms
- Peak Memory
- ≥460.0 KiB