摘要: 没有找到原文出处,请参考一下链接:http://www.cnblogs.com/hiside/archive/2010/12/01/1893878.htmlhttp://topic.csdn.net/u/20071023/11/3edb81fc-37b2-4506-906e-44dc0fc521f2... 阅读全文
posted @ 2015-07-06 16:47 HelloWaston 阅读(2263) 评论(0) 推荐(1) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 5 // 位运算实现加减乘除 6 7 int myAdd(int num1, int num2) 8 { 9 if (num2 == 0) return num1; 1... 阅读全文
posted @ 2015-07-06 16:02 HelloWaston 阅读(1122) 评论(0) 推荐(0) 编辑
摘要: 最近在编程中遇到一个问题:#include using namespace std;int main(){ int n = -2147483648; //cout -2147483648) -2147483648) << endl;因为-2147483648会被转换为unsigned即2147... 阅读全文
posted @ 2015-07-06 15:44 HelloWaston 阅读(1758) 评论(0) 推荐(0) 编辑
摘要: 题意:Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you ca... 阅读全文
posted @ 2015-07-03 11:07 HelloWaston 阅读(257) 评论(0) 推荐(0) 编辑
摘要: 题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your max... 阅读全文
posted @ 2015-07-02 14:56 HelloWaston 阅读(165) 评论(0) 推荐(0) 编辑
摘要: [cpp]view plaincopyintmain(intargc,char*argv[]){mapmapData;mapData["a"]="aaa";mapData["b"]="bbb";mapData["c"]="ccc";for(map::iteratori=mapData.begin()... 阅读全文
posted @ 2015-06-30 19:49 HelloWaston 阅读(411) 评论(0) 推荐(0) 编辑
摘要: 在使用Visual Studio开发调试程序时,我们经常需要打开查看窗口(Watch)来分析变量。有时在查看窗口显示的内容不是很直观。为了能从查看窗口的变量中得到更多的信息,我们需要一些小的技巧。下面是几个例子。1.Windows消息在开发调试界面程序时,我们经常需要查看消息的内容。当在查看窗口中,... 阅读全文
posted @ 2015-06-24 19:48 HelloWaston 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 分治法的基本步骤:1.分解问题(Divide):把原问题分解为若干个与原问题性质相类似的子问题;2.求解字问题(Conquer):不断分解子问题并求解;3.合并子问题的解(Combine).分治法的运用条件:1.原问题可以分解为若干与原问题的解;2.子问题可以分解并可以求解;3.子问题的解可以合并为... 阅读全文
posted @ 2015-06-24 17:17 HelloWaston 阅读(306) 评论(0) 推荐(0) 编辑
摘要: 背景:构造一个无重复的白名单,之后要在里面进行二分查找。故要求名单有序,且无重复,并且要进行二分查找,所以要采用有:随机访问迭代器类型的容器。这类容器有vector,array,deque。显然要vector和deque合适一点,但是deque并没有体现出其两端和中间插入时间为固定而非线性的优势,因... 阅读全文
posted @ 2015-06-23 13:25 HelloWaston 阅读(5209) 评论(0) 推荐(0) 编辑
摘要: 转自:http://blog.csdn.net/kjing/article/details/6936325rbegin和rend,很有用!C++ primer (中文版第四版)第273页9.3.2 begin和end成员 begin和end操作产生指向容器内第一个元素和最后一个元素的下一个位置的迭代... 阅读全文
posted @ 2015-06-23 11:20 HelloWaston 阅读(1276) 评论(0) 推荐(1) 编辑