/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 324.0 KiB
#2 Wrong Answer 0ms 320.0 KiB
#3 Accepted 1ms 324.0 KiB
#4 Wrong Answer 1ms 328.0 KiB

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