刚好在考完当天有一场div3,就开了个小号打了,打的途中被辅导员喊去帮忙,搞了二十分钟-_-||,最后就出了四题,题解如下:
题目链接:http://codeforces.com/contest/1003

 

题目:

Codeforces Round #494 (Div. 3)

思路:求众数出现的次数

代码如下:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 
 4 typedef long long ll;
 5 #define debug(x) cout <<"[" <<x <<"]" <<endl
 6 
 7 const int inf = 0x3f3f3f3f;
 8 const int maxn = 1e5 + 7;
 9 
10 int n;
11 int a[105], vis[105];
12 
13 int main() {
14     cin >>n;
15     int mx = -1;
16     for(int i = 0; i < n; i++) {
17         cin >>a[i];
18         vis[a[i]]++;
19         if(mx < vis[a[i]]) {
20             mx = vis[a[i]];
21         }
22     }
23     cout <<mx <<endl;
24     return 0;
25 }
View Code

相关文章:

  • 2021-10-20
  • 2021-08-22
  • 2021-07-24
  • 2021-10-21
  • 2022-01-08
  • 2021-09-09
  • 2021-11-08
  • 2021-05-23
猜你喜欢
  • 2021-08-04
  • 2022-12-23
  • 2021-09-01
  • 2021-04-06
  • 2021-05-01
  • 2022-01-15
  • 2021-10-27
相关资源
相似解决方案