STL中有一个优先队列的容器可以使用。【头文件】queue 队列容器vector 向量容器【操作】优先级队列支持的操作q.empty() 如果队列为空,则返回true,否则返回falseq.size()返回队列中元素的个数q.pop() 删除队首元素,但不返回其值q.top() 返回具有最高优先级的...
分类:
其他好文 时间:
2014-09-06 22:27:13
阅读次数:
223
简单的来讲就是把字符串进行比较,从第一个相同的位置开始,之后逐个比对,直到不相同为止,此时比较相同字符数目与子串长度的关系,相同则返回第一个相同位置,否则返回-1 1 #include 2 3 int find_substr(char *mainstr,char *substr); 4 5 in.....
分类:
其他好文 时间:
2014-09-06 22:26:43
阅读次数:
293
1 #include 2 using namespace std; 3 4 class Complex 5 { 6 double real, imag; 7 public: 8 Complex(double r, double i) :real(r), imag(i){} 9 ...
分类:
其他好文 时间:
2014-09-06 22:26:23
阅读次数:
310
方法三:因为N*M的取值就是1,10,11,100,101,110,111,......所以直接在这个空间搜索,这是对方法一的改进。搜索这个序列直到找到一个能被N整除的数,它就是N*M,然后可计算出M。例如N=3时,搜索树如下:上图中括号内表示模3的余数。括号外表示被搜索的数。左子树表示0,右子树表...
分类:
其他好文 时间:
2014-09-06 22:26:13
阅读次数:
415
"I do not object to harsh criticism," said Helen Keller, "so long as I am treated like a human being who has a mind of her own." The Story of My Lif.....
分类:
其他好文 时间:
2014-09-06 22:25:33
阅读次数:
288
当前主流的源代码版本控制系统有:CVS、 SVN、Git、Bazzar、Mercurial等几类;多数开源软件源代码都是由上述工具管理,典型的 Linux kernel之前通过SVN,现在由Git工具管理,Ubuntu 发行版所有源代码由 Bazzar 管理。Git、Mercurial和Bazzar...
分类:
其他好文 时间:
2014-09-06 22:25:04
阅读次数:
354
一个只读属性,该值描述了此元素是否捕获到了鼠标,如果该值为true,则说明此元素捕获到了鼠标;否则,未捕获到(例如:当鼠标进入到一个Button的可视化范围之内,当Button按钮外观效果发生了变化时,则说明Button按钮捕获了鼠标,此时读取Button的IsMouseCaptured属性值,会....
分类:
其他好文 时间:
2014-09-06 22:24:43
阅读次数:
317
Source: http://acm.tju.edu.cn/toj/showp.php?pid=2850题意:n*m的土地上种东西,每个位置分为可以种和不能,种的方案要求不能相邻地种,问合法方案数。(写得有点乱)分析:做过炮兵阵地,这题就是秒杀了。 1 #include 2 #include 3 #...
分类:
其他好文 时间:
2014-09-06 22:24:23
阅读次数:
233
校正参数的生成方法以前面已经介绍:
http://blog.csdn.net/b5w2p0/article/details/39099177
采用OpenCV中校正函数进行Remap校正,
cv::Mat frame0, frame1, img0, img1;
frame0 = imread("1_3.bmp");
frame1 = imread("1_4...
分类:
其他好文 时间:
2014-09-06 21:22:04
阅读次数:
302
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4470
Go is a proverbial board game originated in China. It has been proved to be the most diffic...
分类:
其他好文 时间:
2014-09-06 21:21:53
阅读次数:
457
Description
Problem H: Queuing at the doctors
Due to the increasing number of weird viruses spreading around, all the members of the International Confederation of Revolver Enthusiasts (ICORE) ar...
分类:
其他好文 时间:
2014-09-06 21:21:44
阅读次数:
369
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4808
被这道题坑惨了。
有一个吸血鬼被困了,有n条路可以逃出去,每条路有一个难度c[],他初始的战斗力是f,对于第i条路,若f > c[i]他花t[i]天就能出去,否则,他就停留一天,同时战斗力增加c[i]然后再选一条路走出去,他走每条路的概率是相同的。问他逃出去的...
分类:
其他好文 时间:
2014-09-06 21:21:40
阅读次数:
252
整合两道差不多的题目放上来,其中第一题是第二题的基础。
1.
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two...
分类:
其他好文 时间:
2014-09-06 21:21:03
阅读次数:
279
还在为hibernate映射文件太多不好维护发愁吗?如果也不想写映射文件,那么试试JPA吧,一定会减轻很多开发负担的。不可错过的好文章哦。...
分类:
其他好文 时间:
2014-09-06 21:20:44
阅读次数:
306
Matlab基础学习-----数据显示格式(设置)...
分类:
其他好文 时间:
2014-09-06 21:20:33
阅读次数:
240
Reverse Integer 解题总结
1.把integer转为String,利用StringBuilder有reverse方法;
2.构造函数StringBuilder如果是int参数代表是capacity而非想象中的那样;
3.难点是判断溢出问题(虽然不判断可以AC通过),简单的方法是利用long来保留翻转之后的结果,而后和 Integer.MIN_VALUE, Integer.M...
分类:
其他好文 时间:
2014-09-06 21:20:14
阅读次数:
227
ZOJ 2587 Unique Attack
链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1587
题意:N 台超级计算机连成一个网络。M 对计算机之间用光纤直接连在一起,光纤的连接是双向的。数据可以直接在有光纤直接连接的计算机之间传输,也可以通过一些计算机作为中转来传输。
有一群恐怖分子计划攻击网络。他...
分类:
其他好文 时间:
2014-09-06 21:19:53
阅读次数:
300