题解 | #记票统计#

记票统计

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

while True:
    try:
        x=int(input())
        arr1=input().split()
        if len(arr1)==x and 1<=len(arr1)<=100:
            y=int(input())
            arr2=input().split()
            if len(arr2)==y and 1<=len(arr2)<=100:
                dic={}
                for a in arr1:
                    dic[a]=0
                    for b in arr2:
                        if b==a:
                            dic[a]+=1
                for val in dic.values():
                    y=y-val
                dic['Invalid']=y
                
                for key,value in dic.items():
                    print(key+' : '+str(value))
        break
    except:
        break
全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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