m=int(input()) e=1 for i in range(m):
x=input().split()
num=[]
for a in x:
num.append(int(a))
d=len(num)
for b in range(1,d):
count=0
for c in range(b,d):
if num[b]==num[c]:
count+=1
if count%2!=0:
print(f"No{e}. The odd integer is: {num[b]}.")
break
else:
continue
e+=1
因为解答错误。对测试点一,一个询问的答案是 1000
,你的输出是 4
。
参考 AC 代码:
for h in range(int(input())):
x = [int(i) for i in input().split()][1:]
times = [0 for i in range(max(x)+1)]
for i in x:
times[i] += 1
for i in x:
if times[i]%2:
print('No%d. The odd integer is: %d.'%(h+1,i))
break