hdoj 1029 Ignatius and the Princess IV
2017-08-08 15:35
344 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1029
用map储存 map<数字,该数字出现的次数>s;
用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; }
相关文章推荐
- HDOJ 1029 Ignatius and the Princess IV 【数论】
- hdoj 1029 Ignatius and the Princess IV
- HDOJ/HDU 1029 Ignatius and the Princess IV(简单DP,排序)
- HDOJ 1029 Ignatius and the Princess IV
- hdoj-1029-Ignatius and the Princess IV
- HDOJ 1029 Ignatius and the Princess IV 【math】
- 杭电OJ(HDOJ)1029题:Ignatius and the Princess IV(数论)
- HDOJ/HDU 1029 Ignatius and the Princess IV(简单DP,排序)
- HDOJ 1029 Ignatius and the Princess IV
- HDOJ HDU 1029 Ignatius and the Princess IV
- HDOJ 1029 Ignatius and the Princess IV(数位dp)
- hdoj1029 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
- ACM--最少(n+1)/2--HDOJ 1029--Ignatius and the Princess IV--水
- hdoj 1029 Ignatius and the Princess IV
- HDOJ1029 Ignatius and the Princess IV【AC率最高的一题】-----武科大ACM暑期集训队选拔赛3题
- HDOJ 1029:Ignatius and the Princess IV 解题报告