The only difference with version I is: one number can only be used once:class Solution {public: vector > ret; struct Rec { Rec() : sum...
分类:
其他好文 时间:
2014-07-31 05:22:25
阅读次数:
239
题目:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and ....
分类:
编程语言 时间:
2014-07-31 05:22:15
阅读次数:
287
题目:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given su....
分类:
编程语言 时间:
2014-07-31 05:21:25
阅读次数:
214
题意:对一串数字进行抑或某数,和某数,或某数,统计某区间和的操作。思路:因为化成二进制就4位可以建4颗线段树,每颗代表一位二进制。and 如果该为是1 直接无视,是0则成段赋值为0;or 如果是0 无视,是1则成段赋值为1;xor 成段亦或,1个数和0个数交换;sum 求和;#include#inc...
分类:
其他好文 时间:
2014-07-31 02:22:55
阅读次数:
258
注:此文为《C Primer Plus》一书中的部分总结,写下来方便以后参考。 用于存储程序数据的内存可用存储时期、作用域和链接来表征。 存储时期可以使静态的、自动的或者分配的。①如果是静态的,内存在程序开始执行时被分配,并行程序运行时一直存在。②如果是自动的,变量所用内存在程序执行到该变量定义.....
分类:
编程语言 时间:
2014-07-31 02:22:35
阅读次数:
282
Description
The Fibonacci sequence is the sequence of numbers such that every element is equal to the sum of the two previous elements, except for the first two elements f0 and f1 which are respect...
分类:
其他好文 时间:
2014-07-31 00:08:05
阅读次数:
281
贪心思想. 先按左端点排序. 然后一个个挑. 如果当前的右端点<=上一个右端点,说明看当前这个,比看上一个所占时间要少, 用当前这个代替上一个节目; 如果 当前的左端点 大于或等于上一个的右端点. 说明可以两个都看,sum++;...
分类:
其他好文 时间:
2014-07-31 00:05:15
阅读次数:
215
用C语言产生随机数重要用到rand函数、srand函数、及宏RAND_MAX(32767),它们均在stdlib.h中进行了声明。
int rand(void);//生成一个随机数
voidsrand(unsigned int seed); //为rand设置“种子”的值
srand()就是给rand()提供种子seed,如果srand每次输入的数值是一样的,那么每次运行产生的随...
分类:
编程语言 时间:
2014-07-30 23:56:05
阅读次数:
294
初始文件格式:svid=26,frm_cnt=1,max_freq=233,max_chip=90,max_mag = 1085svid=26,frm_cnt=2,max_freq=261,max_chip=3996,max_mag = 10fcawk,sed相关命令:sed 's/=/ /g;s/...
分类:
其他好文 时间:
2014-07-30 23:20:15
阅读次数:
240
数据库中的数据是这样的:筛选出来的数据是这样的:怎样用一句sql,把数据从数据库中筛选出来,实现上图的结果?解决:select系统名称,sum(casewhen故障状态='已处理'then1else0end)as已处理个数,sum(casewhen故障状态='未处理'then1else0end)as...
分类:
数据库 时间:
2014-07-30 20:35:04
阅读次数:
278