题解 | #众数#Python真是太优雅了
众数
https://www.nowcoder.com/practice/1549bbe3d8f546f888f4290250d9e2a6
from collections import Counter print(sorted(Counter(map(int, input().split())).items(), key=lambda x: (-x[1], x[0]))[0][0])
众数
https://www.nowcoder.com/practice/1549bbe3d8f546f888f4290250d9e2a6
from collections import Counter print(sorted(Counter(map(int, input().split())).items(), key=lambda x: (-x[1], x[0]))[0][0])
相关推荐