uva 484 - The Department of Redundancy Department
2016-01-26 18:52
591 查看
已有的数据结构装不下数据,或者不能处理现有的数据,那就必须要思考其他的辅助手段,辅助结构;
#include <cstdio> #include <map> #include <vector> using namespace std; vector<int> order; map<int, int> freq; int main() { int n; freq.clear(); while(scanf("%d", &n) != EOF) { if(freq.count(n)) freq ++; else freq = 1, order.push_back(n); } for(auto it = order.begin(); it != order.end(); ++ it) printf("%d %d\n", *it, freq[*it]); /*for(int i = 0; i < (int)order.size(); i++) printf("%d %d\n", order[i], freq[order[i]]);*/ return 0; }
相关文章推荐
- android View事件传递
- Python中有效的字符串合并方法
- AFNetworking 支持cookies的解决方案
- 怎么解决tomcat占用8080端口问题图文教程
- 使用SQLiteOpenHelper对数据库进行版本管理
- ubuntu下JAVA开发环境搭建及实例
- C3P0官方对于MySQL8小时问题的解决方案
- poj-1195-Mobile phones(二维树状数组)
- vs2008 winform工程打包记录
- ROS_OpenCV_socket客户端发送kinect图像及接受图像
- MR-1.MapReduce概述
- 利用机器学习进行恶意代码分类
- R语言概述
- 【Linux调试经验】编译时sscanf参数警告不可忽略
- Java:使用synchronized和Lock对象获取对象锁
- 关于highChart图形中,环形图像,文字居中的处理
- 用xerces-c来进行xml schema校验
- 对openCV中image.copyTo()的一点理解
- java的参数是值传递而非引用传递
- Activity 重启recreate() 重启Fragment