@[xW_Wx](/user/681523)
这样会简单一些
```cpp
#include<bits/stdc++.h>
using namespace std;
int n=1,x,a[200001];
int main()
{
cin>>x;
for(int i=1;i<=x;i++)
cin>>a[i];
sort(a+1,a+1+x);
for(int i=2;i<=x;i++)
{
if(a[i]==a[i-1])n++;
else
{
cout<<a[i-1]<<" "<<n<<endl;
n=1;
}
}
cout<<a[x]<<" "<<n;
return 0;
}
by YGW6 @ 2023-07-31 10:02:54
@[YGW6](/user/938950)
为什么这就过了呀,不是还有小数的可能吗
by xW_Wx @ 2023-07-31 10:07:44
@[xW_Wx](/user/681523)
他说的是自然数
by YGW6 @ 2023-07-31 10:10:33
这题真坑啊
by xW_Wx @ 2023-07-31 10:32:41