uva 484 - The Department of Redundancy Department
已有的数据结构装不下数据,或者不能处理现有的数据,那就必须要思考其他的辅助手段,辅助结构;
#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[n] ++;
else freq[n] = , 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 ;
}
uva 484 - The Department of Redundancy Department的更多相关文章
- 3ds Max File Format (Part 3: The department of redundancy department; Config)
Now we'll have a look at the Config stream. It begins like follows, and goes on forever with various ...
- The Department of Redundancy Department
Write a program that will remove all duplicates from a sequence of integers and print the list of un ...
- TSQL Beginners Challenge 1 - Find the second highest salary for each department
很久以前准备写的系列文章,后来因为懒一直耽搁着,今天突然决定继续下去,于是有了这篇文章,很基础,但很常用.题目描述依然拷贝.简单来说就是找出个个部门薪水排名第二的人,排名相同的要一起列出来. Intr ...
- [SQL]LeetCode184. 部门工资最高的员工 | Department Highest Salary
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- [SQL]LeetCode185. 部门工资前三高的员工 | Department Top Three Salaries
SQL 架构 Create table If Not Exists Employee (Id ), Salary int, DepartmentId int) Create table If Not ...
- LeetCode——Department Top Three Salaries(巧妙使用子查询)
The Employee table holds all employees. Every employee has an Id, and there is also a column for the ...
- LeetCode——Department Highest Salary(花式使用IN以及GROUP BY)
The Employee table holds all employees. Every employee has an Id, a salary, and there is also a colu ...
- MySQL测试题——开发公司人事管理系统,包括 Employee表 和 Department表
一.需求分析 我们的开发团队,计划开发一款公司人事管理软件,用于帮助中小型企业进行更加高效的人事管理.现在需要对数据库部分进行设计和开发,根据对需求和立项的分析,我们确定该数据库中最核心的两个表为员工 ...
- Mysql 设计超市经营管理系统,包括员工信息表(employee)和 员工部门表(department)
互联网技术学院周测机试题(二) 一.需求分析 为进一步完善连锁超市经营管理,提高管理效率,减少管理成本,决定开发一套商品管理系统,用于日常的管理.本系统分为商品管理.员工管理.店铺管理,库存管理等功能 ...
随机推荐
- 【JavsScript】关于javascript的路线
Client JS: Level 1 基本对象的掌握----------------------------------------->Library(兼容)/Widget(UI+功能)---- ...
- Windows系统编程之进程间通信
Windows系统编程之进程间通信作者:北极星2003来源:看雪论坛(www.pediy.com)Windows 的IPC(进程间通信)机制主要是异步管道和命名管道.(至于其他的IPC方式,例如内存映 ...
- 多线程Two-Phase Termination Pattern两阶段终止模式
一 Two-Phase Termination Pattern Two-Phase Termination Pattern,指的就是当希望结束一个线程的时候,送出一个终止请求,但是不会马上停止,做一些 ...
- Gas Station——LeetCode
There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You ...
- 【搬运】一分钟快速入门OpenStack
一.它是什么,能干什么 想认识一个事物,必须先弄明白它是什么,能干什么. 首先说一下,openstack是一个搭建云平台的一个解决方案,说他不是个软件,但是我觉得说是一个软件,能够让初学者 ...
- [Design Pattern] Filter Pattern 简单案例
Filter Pattern,即过滤模式,通过不同的过滤标准,或者低耦合将过滤标准组合在一起,对一组对象进行过滤,属于结构类的设计模式. 下面是一个过滤模式的简单案例. Criteria 定义过滤接口 ...
- POJ2533 Longest ordered subsequence
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 41984 Acc ...
- 【转】Android:Touch事件分发机制
Touch事件分发中只有两个主角:ViewGroup和View.Activity的Touch事件事实上是调用它内部的ViewGroup的Touch事件,可以直接当成ViewGroup处理. View在 ...
- HDU 5266 pog loves szh III (线段树+在线LCA转RMQ)
题目地址:HDU 5266 这题用转RMQ求LCA的方法来做的很easy,仅仅须要找到l-r区间内的dfs序最大的和最小的就能够.那么用线段树或者RMQ维护一下区间最值就能够了.然后就是找dfs序最大 ...
- linux怎么给一个普通用户reboot权限?
分四种情况讨论:1.让任何人(包括根本不拥有系统帐号的人)都可以通过控制台reboot在/etc/inittab文件中保留ca::ctrlaltdel:/sbin/shutdown -t3 -r no ...