读培养与锻炼程式设计的逻辑脑:世界级程式设计大赛的知识、心得与解题分享

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语言版有说明,但是你也可以看课本,课本解答跟这里的一样,千万不要被蚂蚁的掉头转向欺骗,这种问题还真有趣。