Runtime Error
Code
t=int(input())
for i in range(t):
n=int(input())
summation = 0;
rem_1 = 0
rem_2 = 0
for z in range(n):
x = int(input())
summation += x
if x % 3 == 1:
rem_1 += 1
if x % 3 == 2:
rem_2 += 1
if summation % 3 == 0:
print(n)
print()
elif summation % 3 == 1:
if rem_1 >= 1:
print(n - 1)
print()
else:
print(n - 2)
print()
elif summation % 3 == 2:
if rem_2 >= 1 :
print(n - 1)
print()
else:
print(n - 2)
print()
Information
- Submit By
- Type
- Submission
- Problem
- P1013 Divisible by 3
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-01-06 13:43:04
- Judged At
- 2024-11-11 03:43:48
- Judged By
- Score
- 0
- Total Time
- 27ms
- Peak Memory
- 3.074 MiB