#include<stdio.h>
int score[10] = {80,60,70,55,40,90,100,85,72,31};
char name[10][7] = {"山田","鈴木","杉田","佐藤","木村","村田","中村","白鳥","田中","野田"};
int main(){
int score_max = -1;
int i;
int j;
int k;
int t;
char t2[7];
/* bubblesort */
for (i = 0; i < 10; i++) {
for (j = 0; j < 10 - 1; j++) {
if (score[j] < score[j + 1]) {
/* swap score */
t = score[j];
score[j] = score[j + 1];
score[j + 1] = t;
/* swap name */
for (k = 0; k < 7; k++) {
t2[k] = name[j][k];
}
for (k = 0; k < 7; k++) {
name[j][k] = name[j + 1][k];
}
for (k = 0; k < 7; k++) {
name[j + 1][k] = t2[k];
}
}
}
}
for(i=0;i<10;i++){
printf("%sさんの点数は%dです。\n",name
[i
],score
[i
]); }
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KaW50IHNjb3JlWzEwXSA9IHs4MCw2MCw3MCw1NSw0MCw5MCwxMDAsODUsNzIsMzF9OwpjaGFyIG5hbWVbMTBdWzddID0geyLlsbHnlLAiLCLpiLTmnKgiLCLmnYnnlLAiLCLkvZDol6QiLCLmnKjmnZEiLCLmnZHnlLAiLCLkuK3mnZEiLCLnmb3ps6UiLCLnlLDkuK0iLCLph47nlLAifTsKCmludCBtYWluKCl7CiAgIGludCBzY29yZV9tYXggPSAtMTsKICAgaW50IGk7CiAgIGludCBqOwogICBpbnQgazsKICAgaW50IHQ7CiAgIGNoYXIgdDJbN107CgogICAvKiBidWJibGVzb3J0ICovCiAgIGZvciAoaSA9IDA7IGkgPCAxMDsgaSsrKSB7CiAgICAgIGZvciAoaiA9IDA7IGogPCAxMCAtIDE7IGorKykgewogICAgICAgICBpZiAoc2NvcmVbal0gPCBzY29yZVtqICsgMV0pIHsKICAgICAgICAgICAgLyogc3dhcCBzY29yZSAqLwogICAgICAgICAgICB0ID0gc2NvcmVbal07CiAgICAgICAgICAgIHNjb3JlW2pdID0gc2NvcmVbaiArIDFdOwogICAgICAgICAgICBzY29yZVtqICsgMV0gPSB0OwogICAgICAgICAgICAKICAgICAgICAgICAgLyogc3dhcCBuYW1lICovCiAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPCA3OyBrKyspIHsKICAgICAgICAgICAgICAgdDJba10gPSBuYW1lW2pdW2tdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPCA3OyBrKyspIHsKICAgICAgICAgICAgICAgbmFtZVtqXVtrXSA9IG5hbWVbaiArIDFdW2tdOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPCA3OyBrKyspIHsKICAgICAgICAgICAgICAgbmFtZVtqICsgMV1ba10gPSB0MltrXTsKICAgICAgICAgICAgfQogICAgICAgICB9CiAgICAgIH0KICAgfQoKICAgZm9yKGk9MDtpPDEwO2krKyl7CiAgICAgIHByaW50ZigiJXPjgZXjgpPjga7ngrnmlbDjga8lZOOBp+OBmeOAglxuIixuYW1lW2ldLHNjb3JlW2ldKTsKICAgfQoKICAgcmV0dXJuIDA7Cn0=