讀培養與鍛鍊程式設計的邏輯腦:世界級程式設計大賽的知識、心得與解題分享

Short Coding寫出簡捷好程式-短碼達人的心得技法常被搶購一空,你也可以選擇來自程式的試鍊:專為程式開發人員所寫的技術面試完全攻略,另外填寫姓名郵件地址,經確認還送1點以上,讓你有機會贏得09/09~10/08的新加坡機票一張。

 

 

這本培養與鍛鍊程式設計的邏輯腦:世界級程式設計大賽的知識、心得與解題分享也是ㄚ琪最一週借來看的書,這跟之前ㄚ琪看的

有些類似,一樣都是在解程式題目。

這本書是專為是專為想參加Google Code Jam、TopCoder等世界級程式設計比賽的讀者們所量身打造的書籍。全書分為準備篇、初級篇、中級篇與高級篇4個主要章節,嚴選100個以上「活化」程式設計師大腦的程式邏輯問題,從基礎問題到世界級程式設計大賽的高難度問題,毫不保留地一網打盡。內容包含完全搜尋法、動態規劃法、二元搜尋法、Network flow等重要程式設計觀念。

不管是在學的學生或是現職的程式設計人員,只要掌握住演算法的架構與思維模式,透過本書就能在不知不覺中提升程式設計的功力。

ㄚ琪讀到這裡有點感覺,如果可以熟讀這裡的題目及解法,或許在考經濟部所屬事業機構的台電公司(http://www.taipower.com.tw/)、中油公司(http://www.cpc.com.tw/)、台水公司(http://www.water.gov.tw/)等的新進職員的資訊類別的程式設計,就可以不用怕了。

這本書的主要目的就是:

  • 內容淺顯易懂,在有趣愉快的學習下重新釐清重要概念
    依困難度和關聯性的方式編排,讓讀者分階段進行學習
    透過考古題與原創題目的試作,挑戰自我程式設計能力
    只需具備基礎的程式設計概念,本書就能輕鬆閱讀上手
    匯集了作者參加程式設計比賽所取得的解題技巧和經驗

讓我們一齊『向世界程式設計大賽的殿堂邁進,換一顆程式設計師的邏輯大腦』吧。

目錄有:

第1章 開始挑戰吧!但在這之前─準備篇
1-1 程式設計比賽是什麼?
1-2 有哪些比賽呢?
1-3 本書的學習方式
1-4 該如何提出解答呢?
1-5 如何追求有效率的演算法
1-6 輕鬆的暖身運動

第2章 從基礎開始吧!初級篇
2-1 一切的基礎「完全搜尋法」
2-2 突飛猛進!「貪心法」
2-3 記住值並重新利用的「動態規劃法」
2-4 加工資料並記憶的「資料結構」
2-5 這個與那個其實都是「圖」
2-6 挑戰看看GCJ的問題吧(1)

第3章 大幅提升程度!中級篇
3-1 解決數學問題的要訣
3-2 不是只能搜尋值而已喔!「二元搜尋法」
3-3 嚴選!常用技巧(1)
3-4 操縱各式各樣的資料結構
3-5 掌握動態規劃法!
3-6 以流水解決問題「網路流量」
3-7 挑戰看看GCJ的問題吧(2)

第4章 超越巔峰!高級篇
4-1 更加複雜的數學問題
4-2 找出遊戲的必勝法!
4-3 圖論大師之道
4-4 嚴選!常用技巧(2)
4-5 挑戰看看GCJ的問題吧(3)

讀到1-6輕鬆的暖身運動這裡,有一題是POJ No.1852,題意是這樣:

Description

An army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it immediatelly falls off it. When two ants meet they turn back and start walking in opposite directions. We know the original positions of ants on the pole, unfortunately, we do not know the directions in which the ants are walking. Your task is to compute the earliest and the latest possible times needed for all ants to fall off the pole.

Input

The first line of input contains one integer giving the number of cases that follow. The data for each case start with two integer numbers: the length of the pole (in cm) and n, the number of ants residing on the pole. These two numbers are followed by n integers giving the position of each ant on the pole as the distance measured from the left end of the pole, in no particular order. All input integers are not bigger than 1000000 and they are separated by whitespace.

Output

For each case of input, output two numbers separated by a single space. The first number is the earliest possible time when all ants fall off the pole (if the directions of their walks are chosen appropriately) and the second number is the latest possible such time.

Sample Input

2
10 3
2 6 7
214 7
11 12 7 13 176 23 191

Sample Output

4 8
38 207

POJ 1852 Ants C语言版有說明,但是你也可以看課本,課本解答跟這裡的一樣,千萬不要被螞蟻的掉頭轉向欺騙,這種問題還真有趣。

感謝你看到這裡,很快就可以離開了,但最好的獎勵行動就是按一下幫我分享或留言,感恩喔~

點我分享到Facebook

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *