洛谷:P1093:奖学金


洛谷:P1093:奖学金

Table of Contents

题目

P1093:奖学金

分析

本题的着重点是结构体的排序。一般而言,这类多字段排序需要自定义排序函数,其一般形式如下:

bool cmp(const Student& a, const Student& b)
{
    if (a.total != b.total)
    {
        return a.total > b.total;
    }
    else if (a.chinese != b.chinese)
    {
        return a.chinese > b.chinese;
    }
    else
    {
        return a.id < b.id;
    }
}

答案

Solution

思考

(略)

Previous Next