C语言,快排,计数,输出(long long)
```#include<stdio.h>
#include<stdlib.h>
#define N 200000 //N太大放外边
int cmp (const void *a,const void *b)//排序
{
return *(int*)a-*(int*)b;
}
int main ()
{
long long n=0;
long long a[N];
long long i,j,k;
scanf("%lld",&n);
for(i=0;i<n;i++)
{
scanf("%lld",&a[i]);
}
qsort(a,n,sizeof(long long),cmp);//排序
int cnt=1;
for(j=0;j<n;j++)
{
if(a[j]==a[j+1])
{
cnt++;
}
else
{
printf("%lld %lld\n",a[j],cnt);
cnt=1;//计数更新
}
}
return 0;
}