HackerRank Sorting 3.Comparator 發表於 2021-07-18 分類於 ojques 文章字數: 309 所需閱讀時間 ≈ 1 分鐘 題目連結:Sorting: Comparator | HackerRank比較函式的撰寫 123456789101112struct Player { int score; string name;};class Checker{public: static int comparator(Player a, Player b) { if(a.score!=b.score) return a.score>b.score?0:-1; return a.name<b.name?0:-1; }};