Compile Error
foo.c: In function 'main': foo.c:21:32: error: unknown type name 'can' 21 | printf("%d\n", N); can be selected | ^~~ foo.c:21:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'selected' 21 | printf("%d\n", N); can be selected | ^~~~~~~~ foo.c:22:11: error: expected '}' before 'else' 22 | } else { | ^~~~
Code
#include <stdio.h>
int main() {
int T;
scanf("%d", &T);
while (T--) {
int N;
scanf("%d", &N);
int arr[N];
int i, sum = 0, count = 0;
for (i = 0; i < N; i++) {
scanf("%d", &arr[i]);
sum += arr[i];
}
if (sum % 3 == 0) {
printf("%d\n", N); can be selected
} else {
int remainder = sum % 3;
for (i = 0; i < N; i++) {
if (arr[i] % 3 == remainder) {
count++;
break;
}
}
if (count > 0) {
printf("%d\n", N - 1);
} else {
printf("0\n");
}
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1013 Divisible by 3
- Contest
- Brain booster - 1
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2023-12-31 14:17:29
- Judged At
- 2024-11-11 03:46:21
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes