/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 320.0 KiB
#2 Wrong Answer 26ms 320.0 KiB

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;
    }
    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:26:35
Judged At
2024-11-11 03:46:17
Judged By
Score
0
Total Time
26ms
Peak Memory
320.0 KiB