摘要: Today qiang,who is my classmates,invited me to go along with him to the train station to get the train ticket.I thought it is a good idea,because he can make me to enjoy the journey,at least he know well about tianjin.What is the important is that I think it is a good chance to have the time to get. 阅读全文
posted @ 2013-01-29 16:33 xshang 阅读(288) 评论(0) 推荐(0) 编辑
摘要: from: http://www.cnblogs.com/nokiaguy/archive/2013/01/29/2881476.html有一个已经排序的数组(升序),数组中可能有正数、负数或0,求数组中元素的绝对值最小的数,要求,不能用顺序比较的方法(复杂度需要小于O(n)),可以使用任何语言实现例如,数组{-20,-13,-4, 6, 77,200} ,绝对值最小的是-4。 原文用java写的,没看太懂,但很感谢博主的算法思路,即找正负数的临界值。于是我用C++实现了一遍,代码如下: 1 #include <iostream> 2 #include <cmath> 阅读全文
posted @ 2013-01-29 16:07 xshang 阅读(257) 评论(0) 推荐(0) 编辑