/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 0ms 512.0 KiB
#2 Wrong Answer 0ms 284.0 KiB
#3 Wrong Answer 1ms 516.0 KiB
#4 Wrong Answer 1ms 292.0 KiB
#5 Wrong Answer 1ms 396.0 KiB
#6 Accepted 1ms 460.0 KiB
#7 Wrong Answer 1ms 392.0 KiB

Code

#include <stdio.h>
int main() {
    
    //SAYED AL MAMUN_LU
    
    int t;
    scanf("%d", &t);
    
    while (t--) {
        int yy = 0, yy1 = 0;
        int n;
        scanf("%d", &n);
        
        int samp[n];
        for (int i = 0; i < n; i++) {
            scanf("%d", &samp[i]);
            yy++;
            yy1 += samp[i];
        }
        
        if (yy1 % 3 == 0) {
            printf("%d\n", yy);
        } 
        else {
            if (yy1 % 3 != 0 && yy > 1) {
                printf("%d\n", yy - 1);
            } else {
                printf("-1\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 15:59:16
Judged At
2024-10-03 14:04:57
Judged By
Score
20
Total Time
1ms
Peak Memory
516.0 KiB