/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 332.0 KiB
#2 Time Exceeded ≥1032ms ≥420.0 KiB
#3 Time Exceeded ≥1050ms ≥284.0 KiB
#4 Time Exceeded ≥1095ms ≥332.0 KiB
#5 Time Exceeded ≥1011ms ≥328.0 KiB
#6 Time Exceeded ≥1060ms ≥336.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:29:32
Judged At
2024-10-03 13:07:24
Judged By
Score
10
Total Time
≥1095ms
Peak Memory
≥420.0 KiB