/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 14ms 3.02 MiB
#2 Accepted 14ms 3.02 MiB
#3 Accepted 17ms 3.082 MiB
#4 Accepted 17ms 3.066 MiB
#5 Accepted 19ms 3.074 MiB
#6 Accepted 18ms 3.52 MiB
#7 Accepted 14ms 3.086 MiB

Code

t=int(input())
p=[]
u=0
for i in range(t):
    n=int(input())
    lst=list(map(int,input().split()))
    for z in range(n):
        p.append((lst[z]) % 3)
    if n==len(lst):
        if sum(lst) % 3 == 0 or sum(lst) == 0:
            u += len(lst)
            print(u)
            u=0
        elif sum(lst)%3==1:
            if 1 in p:
                u += len(lst)-1
                print(u)
                u=0
            else:
                u +=len(lst)-2
                print(u)
                u=0
        elif sum(lst)%3==2:
            if 2 in p :
                u +=len(lst)-1
                print(u)
                u=0
            else:
                u +=len(lst)-2
                print(u)
                u=0
    p=[]








Information

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