#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;
}
void s(Body a[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = i + 1; j < n; j++) {
if (a[i].height < a[j].height) {
swap(&a[i], &a[j]);
}
}
}
}
void display(Body a[], int n) {
for (int i = 0; i < n; i++) {
printf("%d %d %d\n", a
[i
].
id, a
[i
].
weight, a
[i
].
height); }
}
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]);
s(a, n);
display(a, n);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgoKdHlwZWRlZiBzdHJ1Y3QgewogICAgaW50IGlkOyAgICAgCiAgICBpbnQgd2VpZ2h0OyAgCiAgICBpbnQgaGVpZ2h0OyAgCn0gQm9keTsKCgp2b2lkIHN3YXAoQm9keSogYSwgQm9keSogYikgewogICAgQm9keSB0ZW1wID0gKmE7CiAgICAqYSA9ICpiOwogICAgKmIgPSB0ZW1wOwp9CgoKdm9pZCBzKEJvZHkgYVtdLCBpbnQgbikgewogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuIC0gMTsgaSsrKSB7CiAgICAgICAgZm9yIChpbnQgaiA9IGkgKyAxOyBqIDwgbjsgaisrKSB7CiAgICAgICAgICAgIGlmIChhW2ldLmhlaWdodCA8IGFbal0uaGVpZ2h0KSB7CiAgICAgICAgICAgICAgICBzd2FwKCZhW2ldLCAmYVtqXSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0KCgp2b2lkIGRpc3BsYXkoQm9keSBhW10sIGludCBuKSB7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIHByaW50ZigiJWQgJWQgJWRcbiIsIGFbaV0uaWQsIGFbaV0ud2VpZ2h0LCBhW2ldLmhlaWdodCk7CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgCiAgICBCb2R5IGFbXSA9IHsKICAgICAgICB7MSwgNjUsIDE2OX0sCiAgICAgICAgezIsIDczLCAxNzB9LAogICAgICAgIHszLCA1OSwgMTYxfSwKICAgICAgICB7NCwgNzksIDE3NX0sCiAgICAgICAgezUsIDU1LCAxNjh9CiAgICB9OwoKICAgIGludCBuID0gc2l6ZW9mKGEpIC8gc2l6ZW9mKGFbMF0pOyAKICAgIHMoYSwgbik7CiAgICBkaXNwbGF5KGEsIG4pOwoKICAgIHJldHVybiAwOwp9CgoK