本地题面缓存已迁移,解析内容待补充。
OJ: noi_openjudge
题目 ID: ch0113-28
难度:未知
标签:python
日期: 2026-07-30 23:01
完整题面见同目录的 problem.md。
problem.md
1 2 3 4 5 6 7from collections import Counter count = int(input()) numbers = list(map(int, input().split())) number, frequency = Counter(numbers).most_common(1)[0] print(number if frequency > count // 2 else "no")
from collections import Counter count = int(input()) numbers = list(map(int, input().split())) number, frequency = Counter(numbers).most_common(1)[0] print(number if frequency > count // 2 else "no")
给出一个含有n(0 < n <= 1000)个整数的数组,请找出其中出现次数超过一半的数。 数组中的数大于-50且小于50。
第一行包含一个整数n,表示数组大小;第二行包含n个整数,分别是数组中的每个元素,相邻两个元素之间用单个空格隔开。
如果存在这样的数,输出这个数;否则输出no。
1 23 1 2 2
3 1 2 2
12
2
习题(13-6)