Wrong Answer
Code
#include <stdio.h>
int main(){
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:45
- Judged At
- 2024-10-03 13:07:25
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 324.0 KiB