题解 | #记票统计#

记票统计

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

n = int(input()) # 候选的人数  4
ls = input().split()    #候选人的名字 A B C D
m = int(input())  # 投票的人数  8
tp = input().split()  # 票数  # A D E CF A GG A B
c = 0

for i in ls:
     c += tp.count(i) 
     print(i + ' : ' + str(tp.count(i)))   # 注意 str(tp.count(i))

print('Invalid : ' + str(m - c))

全部评论

相关推荐

点赞 评论 收藏
分享
认真搞学习:28小登的建议,投算法岗不要写什么物理竞赛,互联网+,多写点项目,用什么算法做了什么。还有本科算法是不可能的开发你这个也没有项目啊
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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