#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int *num = new int[n];
int *numname = new int[n];
int *numcnt = new int[n];
int cnt = 0;
for (int i = 0; i < n; i++)
{
cin >> num[i];
numcnt[i] = 0;
}
for (int i = 0; i < n; i++)
{
bool flag = true;
for (int j = 0; j < n; j++)
{
if (numname[j] == num[i])
{
numcnt[j]++;
flag = false;
}
}
if (flag)
{
numname[cnt] = num[i];
numcnt[cnt]++;
cnt++;
}
}
int temp;
for (int i = 0; i < cnt; i++)
{
for (int j = 0; j < i; j++)
{
if(numname[i] < numname[j])
{
temp = numname[i];
numname[i] = numname[j];
numname[j] = temp;
temp = numcnt[i];
numcnt[i] = numcnt[j];
numcnt[j] = temp;
}
}
}
for (int i = 0; i < cnt; i++)
{
cout << numname[i] << " " << numcnt[i] << endl;
}
delete[] num;
delete[] numname;
delete[] numcnt;
return 0;
}
求求了!!!