题解 | #记票统计#

记票统计

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

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务