#include <stdio.h>
typedef struct{
int id;
int weight;
int height;
}body;
void swap(body *a,body *b);
void height(body a[], int n);
int main(void) {
body a[]= {
{1,65,169},
{2,73,170},
{3,59,161},
{4,79,175},
{5,55,168},
};
int n = sizeof(a) / sizeof(a[0]);
height(a,n);
for(int i=0;i<5;i++){
printf("%d:%d:%d\n",a
[i
].
id,a
[i
].
weight,a
[i
].
height); }
return 0;
}
void swap(body *a,body *b){
body temp;
temp=*a;
*a=*b;
*b=temp;
}
void height(body a[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = i; j < n; j++) {
if (a[i].height < a[j].height) {
swap(&a[i], &a[j]);
}
}
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdHsKCWludCBpZDsKCWludCB3ZWlnaHQ7CglpbnQgaGVpZ2h0Owp9Ym9keTsKdm9pZCBzd2FwKGJvZHkgKmEsYm9keSAqYik7CnZvaWQgaGVpZ2h0KGJvZHkgYVtdLCBpbnQgbik7CmludCBtYWluKHZvaWQpIHsKCWJvZHkgYVtdPSB7Cgl7MSw2NSwxNjl9LAoJezIsNzMsMTcwfSwKCXszLDU5LDE2MX0sCgl7NCw3OSwxNzV9LAoJezUsNTUsMTY4fSwKCQkKCX07CglpbnQgbiA9IHNpemVvZihhKSAvIHNpemVvZihhWzBdKTsKCWhlaWdodChhLG4pOwoJZm9yKGludCBpPTA7aTw1O2krKyl7CglwcmludGYoIiVkOiVkOiVkXG4iLGFbaV0uaWQsYVtpXS53ZWlnaHQsYVtpXS5oZWlnaHQpOwoJfQoKCXJldHVybiAwOwp9CnZvaWQgc3dhcChib2R5ICphLGJvZHkgKmIpewoJYm9keSB0ZW1wOwoJdGVtcD0qYTsKCSphPSpiOwoJKmI9dGVtcDsKfQp2b2lkIGhlaWdodChib2R5IGFbXSwgaW50IG4pIHsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbiAtIDE7IGkrKykgewogICAgICAgIGZvciAoaW50IGogPSBpOyBqIDwgbjsgaisrKSB7CiAgICAgICAgICAgIGlmIChhW2ldLmhlaWdodCA8IGFbal0uaGVpZ2h0KSB7CiAgICAgICAgICAgICAgICBzd2FwKCZhW2ldLCAmYVtqXSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0K