当前位置:网站首页>CSP numeric sort
CSP numeric sort
2022-07-06 02:39:00 【< WRM>】
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
struct node {
int cunt;
int data;
}a[N];
bool compare(node x,node y) {
if(x.cunt!=y.cunt) {
return x.cunt>y.cunt;
}
return x.data<y.data;
}
int b[N];
int main() {
int n;
scanf("%d",&n);
int x;
memset(b,0,sizeof(b));
for(int i=1;i<=n;i++) {
scanf("%d",&x);
b[x]++;
}
int k=-1;
for(int i=0;i<=1000;i++) {
if(b[i]) {
k++;
a[k].data=i;
a[k].cunt=b[i];
}
}
sort(a,a+k+1,compare);
for(int i=0;i<=k;i++) {
printf("%d %d\n",a[i].data,a[i].cunt);
}
return 0;
}
边栏推荐
- CobaltStrike-4.4-K8修改版安装使用教程
- Keyword static
- Blue Bridge Cup group B provincial preliminaries first question 2013 (Gauss Diary)
- MySQL (IV) - transactions
- [postgraduate entrance examination English] prepare for 2023, learn list5 words
- Template_ Quick sort_ Double pointer
- Which ecology is better, such as Mi family, graffiti, hilink, zhiting, etc? Analysis of five mainstream smart brands
- Shell script updates stored procedure to database
- The third level of C language punch in
- 主数据管理理论与实践
猜你喜欢

Li Kou today's question -729 My schedule I

QT release exe software and modify exe application icon

Initial understanding of pointer variables
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11](/img/6a/398d9cceecdd9d7c9c4613d8b5ca27.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 11
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8](/img/16/33f5623625ba817e6e022b5cb7ff5d.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 8
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18](/img/1a/94ef8be5c06c2d1c52fc8ce7f03ea7.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
![[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21](/img/73/4050a592fdd99bf06e8fd853b157b6.jpg)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 21

Ue4- how to make a simple TPS role (II) - realize the basic movement of the role

2022 China eye Expo, Shandong vision prevention and control exhibition, myopia, China myopia correction Exhibition

技术管理进阶——什么是管理者之体力、脑力、心力
随机推荐
Redis skip table
大厂镜像库
在GBase 8c数据库中使用自带工具检查健康状态时,需要注意什么?
What should we pay attention to when using the built-in tool to check the health status in gbase 8C database?
High number_ Vector algebra_ Unit vector_ Angle between vector and coordinate axis
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 15
Large scale DDoS attacks take Myanmar offline
Advanced technology management - what is the physical, mental and mental strength of managers
Trends in DDoS Attacks
MySQL winter vacation self-study 2022 11 (8)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
一个复制也能玩出花来
LeetCode 103. Binary tree zigzag level order transverse - Binary Tree Series Question 5
PAT甲级 1033 To Fill or Not to Fill
RobotFramework入门(三)WebUI自动化之百度搜索
Pure QT version of Chinese chess: realize two-man, man-machine and network games
Solution: attributeerror: 'STR' object has no attribute 'decode‘
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7
2020.02.11
Paper notes: graph neural network gat