Read this question, you can see the subject of the claim is the sort + Find, determination algorithm is divided into two parts
1. Sort
2. Find
Sorting section can be used to quickly implement the sort function
And you can find part two for loops by hand to achieve
//C++
#include <bits / stdc ++. h> // header files
using namespace std;
int main ()
{
int in[200050],out[200050],data,n;
int i,j;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>in[i];
}
// read the end
sort (in + 1, in + n + 1); // header file <algorithm>, sorting function, eliminating the pain handwritten
// use sort (array name + first coordinate array to be sorted array name + last coordinate + 1 array to be sorted);
End // Sort
for(i=1;i<=n;i++)
{
data = 0; // counter to zero
for(j=i+1;j<=n;j++)
{
if(in[i]==in[j])
{
data ++; // the same, adding the counter
}
}
cout << in [i] << "" << data [i] +1 << endl; / * print the same number and the number of occurrences, data recall plus one, which is itself a * /
i = data + i; // preventing repetitive printing key []
}
return 0;
}
----------