struct god{
ll price;
ll number;
}goods[100001];
int cmp(const void *a, const void *b)
{
const struct god* s1 = (const struct god*)a;
const struct god* s2 = (const struct god*)b;
if (s1->price < s2->price)
{
return -1;
}
else if (s1->price > s2->price)
{
return 1;
}
else
{
return 0;
}
}
qsort(goods, n, sizeof(struct god), cmp);
先记着,有时间再写注释