题解 | #记票统计#
记票统计
https://www.nowcoder.com/practice/3350d379a5d44054b219de7af6708894
# 20241008
n = int(input()) #候选人
ls = input().split() #候选人的名字
m = int(input()) #投票的人数
ls1 = input().split() #投票
c = 0
for i in ls:
c += ls1.count(i)
print(i+' : '+str(ls1.count(i)))
print("Invalid : " + str(m-c))

查看29道真题和解析