Time Exceeded
Code
#include <cstdio>
using namespace std;
#define ll long long
void solve()
{
ll n, m;
scanf("%lld %lld", &n, &m);
ll smaller = (n < m) ? n : m;
for (ll i = 2; i <= smaller; ++i)
{
if (n % i == 0 && m % i == 0)
{
printf("%lld\n", i);
return;
}
}
printf("-1\n");
}
int main()
{
int t;
scanf("%d", &t);
while (t--)
solve();
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 14:52:01
- Judged At
- 2024-11-11 03:46:07
- Judged By
- Score
- 50
- Total Time
- ≥3023ms
- Peak Memory
- ≥456.0 KiB