/ SeriousOJ /

Record Detail

Compile Error

foo.c: In function 'gcd':
foo.c:6:15: error: expected '(' before 'b'
    6 |            if b==0
      |               ^
      |               (
foo.c: In function 'main':
foo.c:31:1: error: expected declaration or statement at end of input
   31 | }
      | ^

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:25:48
Judged At
2024-10-03 13:07:39
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes