刚好在考完当天有一场div3,就开了个小号打了,打的途中被辅导员喊去帮忙,搞了二十分钟-_-||,最后就出了四题,题解如下:
题目链接:http://codeforces.com/contest/1003
题目:
思路:求众数出现的次数
代码如下:
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 }