当前位置:网站首页>Translation D29 (with AC code POJ 27:mode of sequence)
Translation D29 (with AC code POJ 27:mode of sequence)
2022-07-04 12:07:00 【Ctrl AC】
“ Ctrl AC! Together AC!”
The original title is :Mode of Sequence
My translation :
describe
Given a N Sequence of Numbers . Find the pattern in the sequence M, To cause to appear in a sequence M The largest number of .
Input
first line : A positive integer N(N<=100). The second line :N A positive integer (<=100000).
Output
An integer M.
AC Code :
#include<bits/stdc++.h>
using namespace std;
map<int,int> mp;
bool cmp(pair<int,int> a,pair<int,int> b){
return a.second>b.second;
}
int main(){
int n;cin>>n;
while(n--){
int num;cin>>num;
mp[num]++;
}
vector<pair<int,int>> vec(mp.begin(),mp.end());
sort(vec.begin(),vec.end(),cmp);
cout<<vec[0].first<<endl;
return 0;
}
Thank you for reading !!!
“ Ctrl AC! Together AC!”
边栏推荐
- (2021-08-20) web crawler learning 2
- thread
- 2021-11-02
- 'using an alias column in the where clause in PostgreSQL' - using an alias column in the where clause in PostgreSQL
- Summary of collection: (to be updated)
- Iframe to only show a certain part of the page
- OSI seven layer reference model
- Introduction of network security research direction of Shanghai Jiaotong University
- How to judge the advantages and disadvantages of low code products in the market?
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 7
猜你喜欢
Method of setting default items in C # ComboBox control code
OSI seven layer model & unit
Data communication and network: ch13 Ethernet
The frost peel off the purple dragon scale, and the xiariba people will talk about database SQL optimization and the principle of indexing (primary / secondary / clustered / non clustered)
DVC use case (VI): Data Registry
Review of week 278 of leetcode II
2018 meisai modeling summary +latex standard meisai template sharing
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 20
Enter the smart Park, and change begins here
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 16
随机推荐
Workplace liquor bureau must pay attention to
13、 C window form technology and basic controls (3)
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 23
Lecture 9
Snowflake won the 2021 annual database
Method of setting default items in C # ComboBox control code
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 6
Alibaba cloud server connection intranet operation
Postman advanced
TCP fast retransmission sack mechanism
[solve the error of this pointing in the applet] SetData of undefined
Force buckle 142 Circular linked list II
C language compilation process
CSDN documentation specification
TCP slicing and PSH understanding
Simple understanding of string
How do std:: function and function pointer assign values to each other
2021-10-20
DDS-YYDS
Map container