| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 
 | #include<stdio.h>#include<string.h>
 void swap(int *score_a, int *score_b, char *name_a, char *name_b);
 int main (void)
 {
 int number, count;
 while (scanf("%d", &number) != EOF)
 {
 putchar('\n');
 int scores[number];
 char names[number][81];
 for (count = 0 ; count < number ; ++count)
 scanf("%s%d", names[count], &scores[count]);
 int i, j;
 for (i = 0 ; i < number ; ++i)
 for (j = i ; j < number ; ++j)
 if (scores[i] < scores[j])
 swap(&scores[i], &scores[j], &names[i][0], &names[j][0]);
 for (count = 0 ; count < number ; ++count)
 printf("%s %d\n", names[count], scores[count]);
 putchar('\n');
 }
 return 0;
 }
 
 void swap(int *score_a, int *score_b, char *name_a, char *name_b)
 {
 int t;
 char str_t[81];
 t = *score_a;
 *score_a = *score_b;
 *score_b = t;
 strcpy(str_t, name_a);
 strcpy(name_a, name_b);
 strcpy(name_b, str_t);
 return;
 }
 
 |