/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 3.105 MiB
#2 Accepted 14ms 3.105 MiB
#3 Accepted 16ms 3.156 MiB
#4 Accepted 16ms 3.035 MiB
#5 Accepted 18ms 3.094 MiB
#6 Accepted 17ms 3.617 MiB
#7 Accepted 14ms 2.977 MiB

Code

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    li = []
    l = len(arr)
    count = 0
    for i in arr:
        li.append(i%3)
    if sum(arr)%3 == 0:
        count += l
    elif sum(arr)%3 == 1:
        if 1 in li:
            count += (l-1)
        else:
            count += (l-2)
    elif sum(arr)%3==2:
        if  2 in li:
            count += (l-1)
        else:
            count += (l-2)
    print(count)

Information

Submit By
Type
Submission
Problem
P1013 Divisible by 3
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-06 19:39:13
Judged At
2024-11-11 03:43:46
Judged By
Score
100
Total Time
18ms
Peak Memory
3.617 MiB