/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 320.0 KiB
#2 Time Exceeded ≥1090ms ≥416.0 KiB
#3 Time Exceeded ≥1093ms ≥324.0 KiB

Code

#include <stdio.h>
int gcd(int a, int b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return (a * b) / gcd(a, b);
}

int main() {
    int T;
    scanf("%d", &T);
    
    while (T--) {
        int A, B;
        scanf("%d %d", &A, &B);

        int count = 0;
        for (int i = 1; i <= A; i++) {
            for (int j = 1; j <= B; j++) {
                if (gcd(i, j) != lcm(i, j)) {
                    count++;
                }
            }
        }
        printf("%d\n", count);
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1075 GCD not equal LCM
Contest
Brain Booster #5
Language
C99 (GCC 13.2.0)
Submit At
2024-09-05 16:28:03
Judged At
2024-11-11 03:00:33
Judged By
Score
10
Total Time
≥1093ms
Peak Memory
≥416.0 KiB