题解 | 简单错误记录

简单错误记录

https://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb

# times 第 i 个元素存储第 i 条记录出现的次数
rec = []
times = []

while True:
    try:
        x, y = input().split()
        # x 取路径后16位后用\分割之后的倒数第一个
        x = x[-16:].split("\\")[-1]
        data = x + " " + y
        if data not in rec:
            rec.append(data)
            times.append(1)
        else:
            times[rec.index(data)] += 1
    except:
        break

for i in range(len(rec[-8:])):
    print(rec[-8:][i], times[rec.index(rec[-8:][i])])

全部评论

相关推荐

06-02 15:53
阳光学院 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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