#include <stdio.h>
typedef struct {
int id;
int weight;
int height;
} Body;
void swap(Body *a, Body *b) {
Body temp = *a;
*a = *b;
*b = 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 - 1; i++) {
for (int j = 0; j < n - 1 - i; j++) {
if (a[j].height < a[j + 1].height) {
swap(&a[j], &a[j + 1]);
}
}
}
for (int i = 0; i < n; i++) {
printf("%d\t%d\t%d\n", a
[i
].
id, a
[i
].
weight, a
[i
].
height); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp0eXBlZGVmIHN0cnVjdCB7CiAgICBpbnQgaWQ7CiAgICBpbnQgd2VpZ2h0OwogICAgaW50IGhlaWdodDsKfSBCb2R5OwoKdm9pZCBzd2FwKEJvZHkgKmEsIEJvZHkgKmIpIHsKICAgIEJvZHkgdGVtcCA9ICphOwogICAgKmEgPSAqYjsKICAgICpiID0gdGVtcDsKfQoKaW50IG1haW4oKSB7CiAgICBCb2R5IGFbXSA9IHsKICAgIAl7MSwgNjUsIDE2OX0sCiAgICAJezIsIDczLCAxNzB9LAogICAgCXszLCA1OSwgMTYxfSwKICAgIAl7NCwgNzksIDE3NX0sCiAgICAJezUsIDU1LCAxNjh9CiAgICB9OwoKICAgIGludCBuID0gc2l6ZW9mKGEpIC8gc2l6ZW9mKGFbMF0pOwoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbiAtIDE7IGkrKykgewogICAgCWZvciAoaW50IGogPSAwOyBqIDwgbiAtIDEgLSBpOyBqKyspIHsKICAgIAkJaWYgKGFbal0uaGVpZ2h0IDwgYVtqICsgMV0uaGVpZ2h0KSB7CiAgICAJCQlzd2FwKCZhW2pdLCAmYVtqICsgMV0pOwogICAgfQogICAgfQogICAgfQoKICAgIHByaW50ZigiSURcdOS9k+mHjVx06Lqr6ZW3XG4iKTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgcHJpbnRmKCIlZFx0JWRcdCVkXG4iLCBhW2ldLmlkLCBhW2ldLndlaWdodCwgYVtpXS5oZWlnaHQpOwogICAgfQoKICAgIHJldHVybiAwOwp9Cgk=