SDUT 数据结构实验之排序三:bucket sort (无语题)

无语了,用c++的头文件必然超时- -!


//#include<algorithm>
#include<stdio.h>
#include<string.h>
//#include<cstdio>
//#include<cstdlib>
//#include<string>
//#include<queue>
//#include<map>
//#include<cmath>
//#define L1 long long
//#define L2 __int64
//#define inf 0x3f3f3f3f
//using namespace std;
//const int m1=1001000;
//const int m2=1010;
//int head[m1],vex[m1],arr[m1];
//bool vis[m2][m2];
int a[110];
int main()
{
    int n,m,i,j,k;
    double x;
    scanf("%d",&n);
    memset(a,0,sizeof(a));

    for(i=0; i<n; i++)
    {
        scanf("%d",&k);
        if(k>100)
            k=100;
        a[k]++;
    }

    for(i=0; i<=100; i++)
    {
        if(!a[i]) continue;
        printf("%d %d\n",i,a[i]);
    }
    return 0;
}


你可能感兴趣的:(排序)