Time Exceeded
Code
#include<stdio.h>
int main()
{
int T;
scanf("%d", &T);
for(int j = 1; j<=T; j++)
{
int n, m, div = 0;
scanf("%d %d", &n, &m);
if(n>m)
{
for(int i = n; i>1; i--)
{
if(n%i == 0 && m%i == 0)
{
div = i;
}
}
if(div == 0)
{
printf("-1");
}
else
{
printf("%d", div);
}
}
else if(m > n)
{
for(int i = m; i>1; i--)
{
if(n%i == 0 && m%i == 0)
{
div = i;
}
}
if(div == 0)
{
printf("-1");
}
else
{
printf("%d", div);
}
}
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1011 LCD
- Contest
- Brain booster - 1
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2023-12-31 14:03:58
- Judged At
- 2024-11-11 03:46:27
- Judged By
- Score
- 0
- Total Time
- ≥3042ms
- Peak Memory
- ≥420.0 KiB