EOJ-----重复数
来源:互联网 发布:布尔教育java怎么样 编辑:程序博客网 时间:2024/06/17 03:05
重复数
Time limit per test: 1.0 seconds
Time limit all tests: 1.0 seconds
Memory limit: 256 megabytes
有n个(1≤n≤1000) int类型的整数,统计其中重复出现次数最多的数。
Input
第 1 行:整数T(1≤T≤10)为问题数。
第 2 行:整数n为第一个问题中整数的个数。
第 3 行:第一个问题中的n个整数,每两个数字之间用一个空格分开。
接下来每个问题占两行,格式与第一个问题相同。
Output
对于每个问题,输出一行问题的编号(0开始编号,格式:case #0: 等);然后在一行中输出1个整数,表示重复出现最多的整数出现的次数。
Examples
Input
348 1 2 1 3-1 -1 10000131 1 1 6 2 3 6 0 4 9 6 5 8
Output
case #0:2case #1:2case #2:3
#include<cstdio>#include<algorithm>#include<iostream>#include<cmath>#include<map>#include<set>using namespace std;int main(){ int t,n,a,cas=0; scanf("%d",&t); while(t--) { set<int> S; map<int,int>Q; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d",&a); S.insert(a); Q[a]++; } int maxx=0; set<int>::iterator it; for(it=S.begin();it!=S.end();it++) { if(Q[*it]>maxx) maxx=Q[*it]; } printf("case #%d:\n%d\n",cas++,maxx); } return 0;}
阅读全文
0 0
- EOJ-----重复数
- EOJ 3236 字串非重复字符数排序
- EOJ 2006 孤独数
- EOJ
- EOJ
- EOJ
- EOJ 1824 Solution Report - 数塔 III
- EOJ 1886 有一个数很特别
- EOJ 3290 找数(III) (模拟+简单数字串)
- 重复数
- 找重复数
- 不重复数
- 去重复数
- 寻找重复的数
- 寻找重复的数
- 找到重复的数
- 查找重复的数
- 不重复数
- 【浅谈守护进程】Demo:后台监控程序-- Python实现
- mysql5.7安装时2503 2502错误以及自定义安装目录
- BZOJ1026 windy数
- Servlet 的生命周期
- 2016多重背包1019
- EOJ-----重复数
- centos7下安装网易云音乐教程及相关依赖关系解决
- C++中printf无法输出问题
- 介绍vue-cli
- 【浅谈康托展开】HDU1043[Eight]题解
- c语言如何从txt文件读取数据
- could not initialize proxy
- N25Q00AA NOR SPIFLASH 的FPGA驱动开发
- Spring连接数据库