题解 | #记票统计#

记票统计

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

while True:
    try:
        num = int(input())
        l_name = input().split()
        num_tou = int(input())
        l_toupiao = input().split()
        count1 = 0
        for i in l_name:
            count1 += l_toupiao.count(i)      #为了统计l_toupiao中在l_name中的数量,为计算无效的票做准备
            print(i + ' : ' + str(l_toupiao.count(i)))  
        print('Invalid : ' + str(num_tou - count1))
    except:
        break
全部评论

相关推荐

肖先生~:大一点得到公司面试更能学到点东西
点赞 评论 收藏
分享
评论
1
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务