题解 | #记票统计#
记票统计
http://www.nowcoder.com/practice/3350d379a5d44054b219de7af6708894
i1 = int(input())
lt1 = input().split( )
i2 = int(input())
lt2 = input().split( )
Invalid = 0
for k in lt2:
if k not in lt1:
Invalid=Invalid+1
for w in lt1:
print(w+' : '+str(lt2.count(w)))
print('Invalid :',Invalid)
lt1 = input().split( )
i2 = int(input())
lt2 = input().split( )
Invalid = 0
for k in lt2:
if k not in lt1:
Invalid=Invalid+1
for w in lt1:
print(w+' : '+str(lt2.count(w)))
print('Invalid :',Invalid)
【牛客站内】华为机试题—简单 文章被收录于专栏
【牛客站内】华为机试题练习记录