Accepted
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