#include <stdio.h>
#include <stdlib.h>
typedef struct _student {
int student;
int score;
} student;
void pp(student*a,int n)
{
int i;
for(i=0; i<n; i++)
printf("student[%d]:%d\n",a
[i
].
student,a
[i
].
score); }
int comp(void const *x,void const *y)
{
return ((student*)y)->score - ((student*)x)->score;
}
int main()
{
int i;
char s[100];
student data[100];
for(i=0;; i++) {
if(s[0]=='\n')break;
sscanf(s
,"%d",&data
[i
].
score); data[i].student=i+1;
}
qsort(data
,i
,sizeof(data
[0]),comp
);
puts("------------------------"); puts("------------------------");
pp(data,i);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCnR5cGVkZWYgc3RydWN0IF9zdHVkZW50IHsKICBpbnQgc3R1ZGVudDsKICBpbnQgc2NvcmU7Cn0gc3R1ZGVudDsKCnZvaWQgcHAoc3R1ZGVudCphLGludCBuKQp7CiAgaW50IGk7CiAgZm9yKGk9MDsgaTxuOyBpKyspCiAgICBwcmludGYoInN0dWRlbnRbJWRdOiVkXG4iLGFbaV0uc3R1ZGVudCxhW2ldLnNjb3JlKTsKICBwdXRjaGFyKCdcbicpOwp9CgppbnQgY29tcCh2b2lkIGNvbnN0ICp4LHZvaWQgY29uc3QgKnkpCnsKICByZXR1cm4gKChzdHVkZW50Kil5KS0+c2NvcmUgLSAoKHN0dWRlbnQqKXgpLT5zY29yZTsKfQoKaW50IG1haW4oKQp7CiAgaW50IGk7CiAgY2hhciBzWzEwMF07CiAgc3R1ZGVudCBkYXRhWzEwMF07CgogIGZvcihpPTA7OyBpKyspIHsKICAgIHByaW50Zigic3R1ZGVudFslZF06IixpKzEpOwogICAgZmdldHMocywxMDAsc3RkaW4pOwogICAgaWYoc1swXT09J1xuJylicmVhazsKICAgIHNzY2FuZihzLCIlZCIsJmRhdGFbaV0uc2NvcmUpOwogICAgZGF0YVtpXS5zdHVkZW50PWkrMTsKICB9CiAgcXNvcnQoZGF0YSxpLHNpemVvZihkYXRhWzBdKSxjb21wKTsKCiAgcHV0cygiLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIik7CiAgcHV0cygi5oiQ57i+6aCG44Gr44K944O844OI44GX44G+44GX44Gf44CCIik7CiAgcHV0cygiLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIik7CgogIHBwKGRhdGEsaSk7CgogIHJldHVybiAwOwp9