#include<iostream>
#include<algorithm>
using namespace std;
struct node
//定义结构体
{
int num;//数据
int count;//出现的次数 计数
};
bool cmp(node a, node b)//排序
{
if (a.count != b.count)
return a.count>b.count;
return a.num<b.num;
}
node a[1005];
//node temp;
int main()
{
int n,x,i;
for ( i = 0; i <= 1000; ++i)
{
a[i].num = i;
}
cin >> n;
for (i = 1; i <= n; ++i)
{
cin >> x;
++a[x].count;
}
sort(a, a + 1005, cmp);
for ( i = 0; i <= n; ++i)
{
if (a[i].count == 0)
break;
cout << a[i].num << " " << a[i].count << endl;
}
return 0;

}

最新文章

  1. 杭电--1102--Constructing Roads--并查集
  2. (转)JS产生随机数的几个用法!
  3. 区分各浏览器的CSS hack(包括360、搜狗、opera)
  4. python入门综合
  5. ASP.NET WebAPI 08 Message,HttpConfiguration,DependencyResolver
  6. linux下系统对于sigsegv错误时的处理
  7. 在Salesforce中调用外部系统所提供的的Web Service
  8. 第一个jsp代码实现简单计算器
  9. BZOJ-4424 &amp;&amp;CodeForces-19E Fairy DP+dfs (Link-Cut-Tree可A)
  10. Objective-C 【关于导入类(@class 和 #import的区别)】
  11. SVN 中trunk、tags、branches使用
  12. DBA查询命令积累——不断更新
  13. PKU 1509 Glass Beads (最小表示法)
  14. 再起航,我的学习笔记之JavaScript设计模式03
  15. TF-IDF特征选择
  16. 【batch】批处理文件多参数处理和for循环字符串连接
  17. 金山wps面经
  18. 配置SQL Server 2016无域AlwaysOn(转)
  19. English trip M1 - AC3 Teacher:Corrine
  20. java集合框架图

热门文章

  1. springcloud干货之服务消费者(ribbon)
  2. 本地idea调试spark2.x程序
  3. LeetCode 238. Product of Array Except Self (去除自己的数组之积)
  4. Python中如何防止sql注入
  5. Ceph: A Scalable, High-Performance Distributed File System译文
  6. PhiloGL学习(6)——深情奉献:快乐的一家
  7. Vue源码学习02 初始化模块init.js
  8. Install a Redmine on Ubuntu system
  9. virualbox 搭建 otter
  10. 使用OpenCV训练Haar like+Adaboost分类器的常见问题