Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-12-08 13:46:49
阅读次数:
138
有时代码看起来是正确的, 可实际上就会有一些没想到的疏忽, 考察以下代码:std::deque ideq{ 5, 13, 2, 25, 7, 17, 20, 8, 4};std::priority_queue priorityQueue (ideq.begin(), ideq.end());for ...
分类:
其他好文 时间:
2014-12-08 12:22:22
阅读次数:
148
#include
#include
#include
using namespace std;
struct edge {
int begin;
int end;
int cost;
};
bool cmp(edge a, edge b)
{
if (a.cost < b.cost)
return true;
return false;
}
int findSet(in...
分类:
编程语言 时间:
2014-12-08 09:21:00
阅读次数:
202
存储过程如同一门程序设计语言,同样包含了数据类型、流程控制、输入和输出和它自己的函数库。--------------------基本语法--------------------一.创建存储过程create procedure sp_name()begin.........end二.调用存储过程1.基...
分类:
其他好文 时间:
2014-12-08 07:06:30
阅读次数:
231
SQL语句之知识补充一.存储过程运用SQL语句,写出一个像函数的模块,这就是存储过程。需求:编写存储过程,查询所有员工--创建存储过程(必须要指定结束符号)--定义结束符号DELIMITER$CREATEPROCEDUREpro_test()BEGINSELECT*FROMstudent;END$C...
分类:
数据库 时间:
2014-12-07 23:00:12
阅读次数:
282
program t;
var n,i:longint;
j,k,m,x,y,ans,m1:int64;
a,b:array[1..10]of int64;
procedure gcd(a,b:int64;var x,y:int64);
var t:int64;
begin
if b=0 then
begin
x:=1;y:=0;exit;
end;
gcd(b,a...
分类:
其他好文 时间:
2014-12-07 19:13:48
阅读次数:
167
对分法的理论依据是:设f是区间[a,b]上得连续函数,满足f(a)f(b)= 0 error('f(a)f(b) tol %这里的tol是指求根时要求的精度 c = (a + b)/2; fc = f(c); if fc ==0 break end ...
分类:
其他好文 时间:
2014-12-07 12:29:07
阅读次数:
357
对于传统的二分查找,若能找到,则返回target的下标,若找不到则返回-1后,退出函数。齐代码比较简单,如下:int bSearch(vec vec, int start,int end,int target){ int first = start,last = end,mid; whi...
分类:
其他好文 时间:
2014-12-06 20:16:48
阅读次数:
275
Linux下,使用unzip解压时,报错:End-of-central-directory signature not found. Either this file is nota zipfile, or it constitutes one disk of a multi-part archiv...
分类:
其他好文 时间:
2014-12-06 20:16:37
阅读次数:
417
题目大意:题意很明确,就是约瑟夫环。不过从第W个位置开始计数1,数S个
位置,然后出环,输出。
思路:用STL里边的string存放小孩的名字。用list双向链表模拟约瑟夫环。
注意:
string里边clear();用来清除所有字符。
list里push_back(i);用来将编号i放入list
begin();指向第一个元素的位置
end();指向最后一个元素后边的位置
list::iterator it;迭代器用来指向报数编号。
find(first,last,value);用来在区间[fi...
分类:
其他好文 时间:
2014-12-06 18:13:16
阅读次数:
237