PAT1054
来源:互联网 发布:php object to array 编辑:程序博客网 时间:2024/05/22 14:41
题目链接PAT1054(A)
本题需要注意的是应当知道采用c++的输入方式会超时,故应当采用c的处理方式,代码如下:
#include <iostream>#include <map>using namespace std;map<int, int> mymap;map<int, int>::iterator it;int main(){ int m, n,s,max=0,flag=-1; cin >> m >> n; for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ scanf("%d", &s); mymap[s]++; } } for (it = mymap.begin(); it != mymap.end(); it++){ if (it->second>max){ max = it->second; flag = it->first; } } printf("%d", flag); system("pause"); return 0;}
0 0
- PAT1054
- PAT1054
- PAT1054
- pat1054 The Dominant Color
- PAT1054 求平均值
- PAT1054. The Dominant Color (20)
- Apple Pay支付流程详解
- 自主输入数值求和及平均值(数组的应用)
- git初始化新项目
- iOS安全系列之二:HTTPS进阶
- JavaScript的三种消息框alert,confirm,prompt
- PAT1054
- 调用AsyncTask的excute方法不能立即执行程序的原因分析及改善方案
- Android6.0的phone应用源码分析(6)——RIL层框架分析
- 使用vector创建一个二维数组(二)
- socket的心跳包机制
- JavaWeb:后台判断是手机登陆还是Pc登陆
- [面试/网络] TCP/IP:数据链路层、IP协议以及IP协议相关技术
- python implement queue
- 2016年3月份工作和学习计划