Xiao Xin's Daily series of stories (10)--ranked TimesTime limit:1000ms Memory limit:65536kb Submit statistic
Problem DescriptionXiao Xin came to Sdut after, after very hard study and efforts finally entered the ACM team. Soon another ACM team's selection is about to begin, and the training teams are busy again. He was also very fortunate to be a senior to be caught as coolie. O (∩_∩) o This seniors assigned him the task is to write an automatic ranking program, we know that when the end of the tryouts, each of the students involved in the selection will have a score of their own. and team need according to everyone's score ranking to decide who can enter the team, this task fell on Xiao Xin body. Can you help Xiao Xin to finish this program?
InputThe first behavior of the input n 0<n<=50; Below there are n rows for each act a person's name and TA's score. Guaranteed not to have the same score. People's names are English words, no more than 10 in length.
OutputThe output is n rows, each line a person's name with his score. There are no extra spaces at the end of each line. The specific output format is shown in the sample example.
Example Input
3
Dan
John
Danny 30
Example Output
John
Danny
Dan 10
#include <stdio.h>
#include <string.h>
int main ()
{
int n,shu[60],t;
int j,i;
Char a[60][20],at[20];
scanf ("%d", &n);
for (i = 0;i < n;i++)
{
scanf ("%s", A[i]);
scanf ("%d", &shu[i]);
for (i = 0;i <= n-1;i++)
{for
(j = 0;j <= n-2-i;j++)
{
if (shu[j]<shu[j+1])
{
t= shu[j],shu[j]=shu[j+1],shu[j+1]=t;
strcpy (At,a[j]);
strcpy (a[j],a[j+1]);
strcpy (a[j+1],at);
}} for (i = 0;i <= n-1;i++)
{
printf ("%s%d\n", A[i],shu[i]);
return 0;
}