Chẵn lẻ

lqdoj
 avatar
tocdovodoi
plain_text
2 months ago
349 B
5
Indexable
Never
def check(s):
    n = str(s)
    for i in range(len(n)):
        if (i % 2 == 0 and int(n[i]) % 2 == 0) or (i % 2 != 0 and int(n[i]) % 2 != 0):
            return 0
    return 1

n = int(input())
ds = []
for i in range(n):
    ds.append(int(input()))
for i in ds:
    if check(i)==1:
        print("YES")
    else:
        print("NO")
Leave a Comment