[Add]
Lambda expressions
在合适的时候使用lambda表达式; 不要使用默认的lambda captures, 使用显式的captures;
[http://en.cppreference.com/w/cpp/language/lambda ]
定义:
lambda表达式是一个创建匿名函数对象anonymous function obj...
分类:
其他好文 时间:
2015-04-19 16:14:21
阅读次数:
168
题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Ele...
分类:
其他好文 时间:
2015-04-19 16:01:36
阅读次数:
137
题意:给你空间中四个点,问你这四个点能否组成正方形。解题思路:看两两之间的距离。根据正方形的性质求解。解题代码: 1 // File Name: c.cpp 2 // Author: darkdream 3 // Created Time: 2014年10月07日 星期二 00时41分28秒 4 ....
分类:
其他好文 时间:
2015-04-19 11:22:19
阅读次数:
117
由于上一节学习了STL的使用,特别学习了vector的学习,所以在这里需要去回顾练习一下。下面是我的代码,我是用vector容器,实现了冒泡排序,选择排序和快速排序。特别的,在最后着重学习一个快速排序的原理。(一):vector练习,实现几个排序算法//================================
// Name : VectorTest.cpp
// Author...
分类:
其他好文 时间:
2015-04-19 08:58:37
阅读次数:
133
在创建Storm的Topology时,我们通常使用如下代码:builder.setBolt("cpp", new CppBolt(), 3).setNumTasks(5).noneGrouping(pre_name);Config conf = new Config();conf.setNumWor...
分类:
其他好文 时间:
2015-04-18 18:58:05
阅读次数:
128
题意:每10秒扫描一下盘子,查看盘子里面的面包个数,问你主角用两种吃法可能吃得的最少的面包。1)任意吃。2)每秒以恒定速度.解题思路:暴力,找差值。解题代码: 1 // File Name: a.cpp 2 // Author: darkdream 3 // Created Time: 2015年0...
分类:
其他好文 时间:
2015-04-18 15:59:44
阅读次数:
111
题意:给你每个理发师的理发时间,问你排在队列中的第N个位置,问你应该被哪个理发师剪发。解题思路:二分时间,看这个时间到第几个人理发了,然后找到临界值,看这个值的时候有那些理发师接待了新旅客的,即可找到那个理发师。解题代码: 1 // File Name: b.sample.cpp 2 // Auth...
分类:
其他好文 时间:
2015-04-18 15:48:31
阅读次数:
133
题目:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two...
分类:
其他好文 时间:
2015-04-18 12:47:09
阅读次数:
145
题目链接:http://cpp.zjut.edu.cn/ShowProblem.aspx?ShowID=1885
题面:
Careless Tony
Time Limit:1000MS Memory Limit:32768K
Description:
Tony is such a careless typist that he finds himself making...
分类:
其他好文 时间:
2015-04-18 08:45:36
阅读次数:
146
http://chenqx.github.io/2014/09/25/Cpp-Memory-Management/ 内存管理是C++最令人切齿痛恨的问题,也是C++最有争议的问题,C++高手从中获得了更好的性能,更大的自由,C++菜鸟的收获则是一遍一遍的检查代码和对C++的痛恨,但内存管理在C++....
分类:
编程语言 时间:
2015-04-18 06:24:53
阅读次数:
202