Skip to content
mtMatt.Page

mtMatt.Page

a common page

  • C++學習心得
  • APCS
    • APCS325
    • APCS實作題
  • 競賽題
  • 解題(解題系統)
  • MISC

HackerRank Sorting 3.Comparator

2021 年 7 月 18 日2022 年 5 月 12 日mattQQhackerRank, OJ, onlineJudge解題(解題系統)

題目連結:Sorting: Comparator | HackerRank

比較函式的撰寫

struct 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;
    }
};

文章導覽

在 Linux 上輕鬆安裝 Fcitx 與嘸蝦米
HackerRank Sorting 4.Fraudulent Activity Notifications

彙整

近期文章

  • LeetCode 1. Two Sum 2022 年 5 月 22 日
  • [版本更新] 快速回顧 微軟發布 KB5013943 (Windows 11 作業系統組建 22000.675) 2022 年 5 月 18 日
  • 在 Linux 上用 Fcitx5 搭配新酷音 2022 年 5 月 12 日
  • 籠中鳥-大考中心試卷 2022 年 4 月 25 日
  • 孫子兵法-謀攻篇帶來的啟示 2022 年 4 月 3 日
  • 圖論測資生成器 2022 年 3 月 20 日
  • 2021 資訊之芽入芽考 E. 大整數 2022 年 1 月 26 日
  • 安裝 MX Linux MX-21 後,我做了一些系統設定 2022 年 1 月 26 日
  • APCS 2022/1/9 2022 年 1 月 10 日
  • 一個非常暴力的常數優化 2022 年 1 月 1 日

標籤

95全國能力競賽 (2) ABC (4) algorithm (1) apcs (14) boshiamy (1) clearLinux (2) coding (1) competition (20) dataStructure (2) debian (1) disjointSets (1) fcitx (2) fcitx-chewing (1) fcitx5 (1) gcin (1) grub (1) hackerRank (19) iBus (1) LeetCode (1) linux (5) macOS (1) mxLinux (1) nhspc (4) OJ (41) onlineJudge (41) reading (2) review (5) scim (1) sproutOJ (2) swupd (1) virtualBox (1) windows (2) windows11 (1) windowsUpdate (1) 全國賽 (4) 嘸蝦米 (1)
Copyright © All rights reserved
↑