题解 | #记票统计#

记票统计

http://www.nowcoder.com/practice/3350d379a5d44054b219de7af6708894

while True: try: n = int(input()) candidate = input().split() m = int(input()) ticket = input().split() invalid = 0 vote = {} for i in candidate: vote[i]=0 for i in ticket: if i not in candidate: invalid += 1 else: vote[i] += 1 for i,j in vote.items(): print(str(i)+" : "+str(j)) print('Invalid : '+str(invalid)) except: break

全部评论

相关推荐

球球别再泡了:坏,我单9要了14
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务