今天学习到STL中的nth_element,她是一个默认能求第k小的数的方法,需要的头文件为algorithm。 默认为:nth_element(start, start+n, end) 使第n大元素处于第n位置(从0开始,其位置是下标为n的元素),并且比这个元素小的元素都排在这个元素之前,...
分类:
其他好文 时间:
2014-09-15 04:30:58
阅读次数:
231
像C语言一样,C#有一些预处理器指令的命令。例如,#if#end if,#define等,所谓这些命令是指不会转化为可执行代码中的一些命令,只是在编译的过程中起作用。下面简要介绍一下:1 、#define和 #undef#define的用法如下所示:#define DEBUG 它告诉编译器存在给定....
分类:
其他好文 时间:
2014-09-15 00:55:17
阅读次数:
184
1.点语法(找出不合理的地方)#import@interfacePerson : NSObject{int_age;}- (void)setAge:(int)age;- (int)age;@end@implementationPerson{int_age;}- (void)setAge:(int)....
分类:
其他好文 时间:
2014-09-14 23:20:57
阅读次数:
217
全排列函数next_permutationSTL中专门用于排列的函数(可以处理存在重复数据集的排列问题)头文件:#includeusingnamespacestd;调用:next_permutation(start,end);注意:函数要求输入的是一个升序排列的序列的头指针和尾指针.用法: 1 //...
分类:
其他好文 时间:
2014-09-14 20:33:27
阅读次数:
361
// 算法:DFS// 递归函数参数使用引用//Time Limit Exceeded 1 class Solution { 2 public: 3 vector > findLadders( string start, string end, unordered_set &dict) { ...
分类:
其他好文 时间:
2014-09-14 11:18:47
阅读次数:
154
var t: TBitBtn;begin t:=TBitBtn.Create(nil); t.Name:='BitBtn100'; t.parent :=Self; // 这里下断点end;一路跟踪就会发现以下函数执行的时候下降(执行子类覆盖函数):TBitBtn.CreateHandle;...
分类:
其他好文 时间:
2014-09-14 05:47:26
阅读次数:
167
利用两个队列(或vector):curlevel和nextlvevl分别表示当前层的所有可能状态和转换到的下一层的所有可能状态。我们的目标是转换到end单词即可,深搜会超时。使用广搜,各层的可能结点同时向下进行,找到end即可return。当找完当前层的所有可能结点后,当前层也就空了,然后swap(...
分类:
其他好文 时间:
2014-09-13 12:02:15
阅读次数:
196
Description
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinki...
分类:
其他好文 时间:
2014-09-12 17:12:53
阅读次数:
202
自己编写一个find查找函数:
static bool find(vector bn_vec, int an){
for(vector::iterator bn_vec_it = bn_vec.begin(); bn_vec_it != bn_vec.end(); bn_vec_it++){
if( *bn_vec_it == an )
return true;
}
return...
分类:
编程语言 时间:
2014-09-12 17:10:23
阅读次数:
1143
declare @start date,@end date;set @start='2010-01-01';set @end='2010-02-01';--获取时间段内日期列表select [day]=dateadd(day, number - 1, @start)from master.dbo.....
分类:
数据库 时间:
2014-09-12 16:39:43
阅读次数:
268