Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
int lcd(int n, int m)
{
int t;
if (n < m)
{
t = n;
}
if (n > m)
{
t = m;
}
if(t == 1){
return 1;
}
for (int i = 1; i < t; i++)
{
if (m % i == 0 && n % i == 0)
{
// cout << i << endl;
return i;
}
}
return -1;
}
int main()
{
int tcase;
cin >> tcase;
while (tcase--)
{
int n, m;
cin >> n >> m;
cout << lcd(n, m) << 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 14:34:02
- Judged At
- 2024-11-11 03:46:14
- Judged By
- Score
- 0
- Total Time
- 24ms
- Peak Memory
- 552.0 KiB