CCF之出现次数最多的数
来源:互联网 发布:出国需要下载什么软件 编辑:程序博客网 时间:2024/06/12 20:51
//使用STL容器的map进行统计#include <iostream>#include <map>using namespace std;int main(){ map<int,int> m; int n,v; //输入数据,构建Map cin >> n; for(int i=0;i<n;i++){ cin >> v; m[v]++; } //找出出现次数最多的数 int ans,count=0; for(map<int,int>::iterator it=m.begin();it!=m.end();it++){ if(it->second>count){ count=it->second; ans=it->first; } } //输出结果 cout << ans << endl; return 0;}
首先导入输入、输出流的头文件<iostream>,
c++输入输出详解
C++的话:
#include <iostream>using namespace std;
STL容器介绍:STLset容器
关于Map(映射):STL7个常用容器比较、深入理解map
阅读全文
0 0
- CCF之出现次数最多的数
- CCF之出现次数最多的数
- CCF认证模拟之出现次数最多的数
- CCF之出现次数最多的数(java)
- CCF 出现次数最多的数
- 【CCF】出现次数最多的数
- ccf 出现次数最多的数
- CCF-出现次数最多的数
- CCF认证-出现次数最多的数
- CCF—出现次数最多的数
- CCF 出现次数最多的数
- CCF 出现次数最多的数
- C++ CCF 出现次数最多的数
- ccf试题 出现次数最多的数
- CCF计算机软件认证题目--出现次数最多的数
- CCF 201312-1出现次数最多的数
- CCF-出现次数最多的数-201312-1
- CCF-CAP 201312-1 出现次数最多的数 答案
- JavaScript函数调用中的this
- matlab之生成不重复的随机整数
- android Cannot merge new index 66221 into a non-jumbo instruction(Android studio)bug
- 微波网络
- HDU 5038 Grade
- CCF之出现次数最多的数
- Static的用法
- 对虚拟化技术的理解
- 社交粉丝数据分析----求qq共同好友
- c++ premier学习笔记(unit1
- HDU
- springboot-AOP
- 欢迎使用CSDN-markdown编辑器
- “健康保”APP主要技术实现方式