Wrong Answer
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);
} 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:16:24
- Judged At
- 2024-11-11 03:46:21
- Judged By
- Score
- 30
- Total Time
- 1ms
- Peak Memory
- 328.0 KiB