面朝大海,春暖花开
从现在起,做一个幸福的人。 读书、工作、周游世界。 想有一所房子,面朝大海,春暖花开
May 22, 2013
Codility - Theta 2011 - gas stations
题目见
https://codility.com/demo/take-sample-test/theta2011/
比较简单的题,思路很直接,贪心法,往后扫描,在当前的加气站如果比后面的加气站便宜的话就尽量多加。只是边界条件要特别小心,很容易出错。
代码见
https://github.com/phiphy/codility/blob/master/gas_stations-Theta_2011.cpp
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment