Educational Codeforces Round 34 (Rated for Div. 2) C
来源:互联网 发布:数据工程理论与技术 编辑:程序博客网 时间:2024/05/22 00:40
找众数的数字有多少个。
例子
4 2 3 3
排序后变成
4
3 3
2
容易证明众数数字的个数就是最大合并的盒子的数目。
#include <cstdio>#include <algorithm>using namespace std;int box[5005];int main(){ int i,n,cnt=1,maxcnt=0; scanf("%d",&n); for(i=0;i<n;i++)scanf("%d",&box[i]); sort(box,box+n); for(i=0;i<n;i++){ if(box[i]==box[i+1])cnt++; else { if(maxcnt<cnt)maxcnt=cnt; cnt=1; } } printf("%d",maxcnt);}
阅读全文
0 0
- Educational Codeforces Round 34 (Rated for Div. 2) C
- Educational Codeforces Round 33 (Rated for Div. 2) C
- Educational Codeforces Round 33 (Rated for Div. 2) C
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 34 (Rated for Div. 2)
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 34 (Rated for Div. 2) D
- Educational Codeforces Round 34 (Rated for Div. 2) A-C 题解
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)B
- Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2) A
- Educational Codeforces Round 33 (Rated for Div. 2) B
- Educational Codeforces Round 33 (Rated for Div. 2)
- Educational Codeforces Round 33 (Rated for Div. 2) 题解
- Educational Codeforces Round 33 (Rated for Div. 2) F
- 统计整数的二进制表达里有多少个1 Python版
- 从零开始学习菜鸟晋级黑客之黑客之“名词介绍”
- 如何使用sklearn进行数据挖掘
- Java并发编程:volatile关键字解析
- 查找整数
- Educational Codeforces Round 34 (Rated for Div. 2) C
- python中使用原始生态sql语句
- 最新版HUSTOJ本地及云端服务器搭建
- 汉诺塔III
- JAVA中long与int的转化
- thrift安装 0.8.0版本
- 15算法课程 292. Nim Game
- 机器学习顶级论文及实现(附地址及简介)
- 注册表键值大全