您的位置:首页 > 编程语言 > Python开发

CCF Python题解(100分)201503-2 数字排序

2018-11-14 22:24 399 查看
from collections import Counter, defaultdict

n = int(input())
data = list(map(int, input().split()))
info = Counter(data)
infolist = []
realdict = defaultdict(set)
for value in info.values():
for key in info.keys():
if info[key] == value:
realdict[value].add(key)
reallist = sorted(realdict.items(), key=lambda e: e[0], reverse=True)
for i in reallist:
for j in sorted(i[1]):
print(j, i[0])
阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: