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