出书最多

GitHub跳转原题关系图返回列表

本地题面缓存已迁移,解析内容待补充。

OJ: noi_openjudge

题目 ID: ch0113-42

难度:未知

标签:python

日期: 2026-07-30 23:01

题意

完整题面见同目录的 problem.md

思路

代码

Python代码

python
from collections import defaultdict

book_count = int(input())
books_by_author = defaultdict(list)

for _ in range(book_count):
    book_id, authors = input().split()
    for author in authors:
        books_by_author[author].append(book_id)

author = max(books_by_author, key=lambda name: len(books_by_author[name]))
print(author)
print(len(books_by_author[author]))
print(*books_by_author[author], sep="\n")

复杂度

总结