2 条题解
-
3
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[1005]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { int cnt = 0; for (int j = 0; j < n; j++) { if (a[j] == a[i]) { cnt++; } } if (cnt > n / 2) { cout << a[i] << endl; break; } } return 0; }
- 1
信息
- ID
- 30980
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- (无)
- 递交数
- 32
- 已通过
- 26
- 上传者