/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 12ms 2.777 MiB
#2 Accepted 12ms 2.777 MiB
#3 Accepted 14ms 2.777 MiB
#4 Accepted 15ms 2.777 MiB
#5 Accepted 16ms 2.91 MiB
#6 Accepted 15ms 3.57 MiB
#7 Accepted 12ms 2.828 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-01-06 19:39:13
Judged By
Score
100
Total Time
16ms
Peak Memory
3.57 MiB