1 条题解
-
-1
def count_blocks(): import sys from collections import defaultdict
# 读取输入 input_line = sys.stdin.read().strip() # 读取输入 if not input_line: # 如果没有输入,直接返回 return # 将输入拆分为列表,并转换为整数 blocks = list(map(int, input_line.split())) # 使用字典统计每个编号的数量 block_count = defaultdict(int) for block in blocks: block_count[block] += 1 # 按照编号排序 sorted_blocks = sorted(block_count.items()) # 输出结果 for block, count in sorted_blocks: print(block, count)
把这玩意写进去就好了,这可是大家最喜欢的py代码啊,然后你就会惊讶的发现c语言和python之间的差距了
信息
- ID
- 77
- 时间
- 200ms
- 内存
- 64MiB
- 难度
- 7
- 标签
- 递交数
- 446
- 已通过
- 28
- 上传者