出處:https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4168
解題策略:貪婪、二元搜尋、最早結束的優先處理
參考程式碼