小鑫の平常系列故事(十)——排名次

#include<stdio.h>
#include<string.h>
int main()
{web

char a[100][100],s[100];
int b[100];
int i,n,j,t;
scanf("%d",&n);
getchar();
for(i = 0; i < n; i++)
{
    scanf("%s %d",&a[i],&b[i]);
}
for(i = 0; i < n; i++)
{
    for(j = 0; j < n - i - 1; j++)
    {
        if(b[j] < b[j+1])
        {
            t = b[j];
            b[j] = b[j+1];
            b[j+1] = t;
            strcpy(s,a[j]);
            strcpy(a[j],a[j+1]);
            strcpy(a[j+1],s);
        }
    }
}
for(i = 0; i < n; i++)
{
    printf("%s ",&a[i]);
    printf("%d\n",b[i]);
}
return 0;

}svg