/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 284.0 KiB
#2 Wrong Answer 0ms 388.0 KiB
#3 Wrong Answer 0ms 340.0 KiB

Code

#include <stdio.h>
int gcm(int a, int b, int c, int x);
int main()
{
    int t;
    scanf("%d", &t);
    while (t--)
    {
        int a, b, c, x;
        scanf("%d %d %d %d", &a, &b, &c, &x);
        printf("%d\n", gcm(a, b, c, x));
    }

    return 0;
}

int gcm(int a, int b, int c, int x)
{
    int yes = 1;
    for (int i = 1; i < x; i++)
    {
        if (i % a == 0 && i % b == 0 && i % c == 0)
        {
            return i;
            break;
        }
        else
        {
            yes = 0;
        }
    }
    if (yes == 0)
    {
        return -1;
    }
}

Information

Submit By
Type
Submission
Problem
P1025 GCM
Language
C99 (GCC 13.2.0)
Submit At
2024-04-25 07:22:58
Judged At
2024-11-11 03:36:14
Judged By
Score
2
Total Time
0ms
Peak Memory
388.0 KiB