hdoj 1029 Ignatius and the Princess IV
来源:互联网 发布:2017单片机前景 编辑:程序博客网 时间:2024/05/01 01:33
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1029
用map储存 map<数字,该数字出现的次数>s;
#include<iostream>#include<cstdio>#include<map>#include<iterator>using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { map<int,int>s; map<int,int>::iterator it; //map和迭代器 可以练习一下 int a,max1=0,ans; while(n--) { scanf("%d",&a); s[a]++; } for(it=s.begin();it!=s.end();it++) { if(max1<it->second) //it->first相当于数组下标 { //it->second相当于当前下表所代表的值 max1=it->second; ans=it->first; } } printf("%d\n",ans); } return 0;}
阅读全文
0 0
- 【HDOJ】1029 -> Ignatius and the Princess IV
- hdoj 1029 Ignatius and the Princess IV
- HDOJ 1029 Ignatius and the Princess IV
- HDOJ Ignatius and the Princess IV 1029
- HDOJ 1029 Ignatius and the Princess IV
- hdoj 1029 Ignatius and the Princess IV
- HDOJ 1029 Ignatius and the Princess IV
- hdoj-1029-Ignatius and the Princess IV
- hdoj 1029 Ignatius and the Princess IV
- HDOJ 1029 Ignatius and the Princess IV
- HDOJ 1029 Ignatius and the Princess IV [map]
- HDOJ 1029:Ignatius and the Princess IV 解题报告
- hdoj.1029 Ignatius and the Princess IV 20140809
- HDOJ 1029 Ignatius and the Princess IV 【math】
- hdoj 1029 Ignatius and the Princess IV 【简单】
- HDOJ 1029 Ignatius and the Princess IV (水题)
- HDOJ 1029 Ignatius and the Princess IV(易题)
- 杭电HDOJ 1029 Ignatius and the Princess IV
- 新版MT4基础架构函数
- archlinux客户端配置终端和firefox的privoxy+ss代理
- Python学习之高级函数详解
- Web21.Math数组Date
- 关于php 中spl_autoload_register的一些补充
- hdoj 1029 Ignatius and the Princess IV
- CREATE TABLE 语句
- Python机器学习笔记——无监督学习
- ILRuntime第三课Delegate
- 普元 EOS Platform 7.5 将逻辑流封装为webservice,wsdl文件上右键,生成客户端代码,提示:选择的wsdl文件中没有服务信息
- Android NDK: From Elementary to Expert Episode 22
- dynamic_cast的一些疑问
- Java中void、return、返回值的详解
- hibernate中多对一、一对一、一对多、多对多的配置方法