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
- C99 (GCC 13.2.0)
- Submit At
- 2023-12-31 16:19:43
- Judged At
- 2024-11-11 03:45:13
- Judged By
- Score
- 50
- Total Time
- ≥3088ms
- Peak Memory
- ≥452.0 KiB