What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extra space.For example,Given ...
分类:
其他好文 时间:
2014-07-22 08:37:34
阅读次数:
289
先上模板 1 #include 2 #include 3 const int P=(1>=1,t=t*t%mod)if(k&1)f=f*t%mod;return f;} 6 int a[1j)tmp=x[i],x[i]=x[j],x[j]=tmp;13 for(l=k>>1;(j^=...
分类:
其他好文 时间:
2014-07-22 08:19:37
阅读次数:
416
Trie的简单应用,只涉及插入字符串的操作。需要注意的是,输入数据有T组,在处理每一组数据之前都要初始化root,由于忽视了这一点WA了n次。还有一点就是,在发现一组数据答案为“NO”之后,仍然要读完这组数据的字符串。在这一点上也WA了好多次= =另外,本题大概需要建立4000000个节点,如果采用...
分类:
其他好文 时间:
2014-07-21 10:39:52
阅读次数:
230
题目地址:All in All题目大意: 判断后一个字符串是否包含前一个字符串,顺序不能改变。解题思路: 以后一个字符串为循环,与要判断的字符串中的字符相等就cnt++。最后cnt==len(需要判断的字符串)是输出YES否则NO。代码: 1 #include 2 #include 3 #i...
分类:
其他好文 时间:
2014-07-21 10:34:09
阅读次数:
265
2.1 明确需求后使用位图索引在创建位图连接索引时,它是两个表或多个表之间的索引值的连接,连接的结果存储在索引自身中;通过前期做连接并存储结果,当查询时通过扫描索引(避免两表或多表全表扫描)来获取数据,当然对于建立这样的索引,建立前需求必须明确; 请观察如下人员信息表(th04)和人员单位关系信息表...
分类:
其他好文 时间:
2014-07-21 10:32:00
阅读次数:
285
一、 1)如果id字段不為null,就加在isNotNull标签语句前加上“and”。2)标签会覆盖子标签中的prepend,上例中,中没有prepend,所以子标签中and会保留。此处的用法是where 1=1,然后是动态sql。还可以,这样可以覆盖子标签中的and,使其变成where。二、...
分类:
数据库 时间:
2014-07-21 10:23:10
阅读次数:
203
移动房间桌子问题通过建立数组作为此房间对应走廊的重叠次数,达到最大的重叠次数及是总时间的10分之1代码: 1 #include 2 #include 3 #include 4 using namespace std; 5 #define MAX 201 6 int f(int n){ 7 r...
分类:
其他好文 时间:
2014-07-21 10:22:44
阅读次数:
228
在1.4.0之前(不包含1.4.0)无法使用多个绑定的,单个示例为:$('.clickme').live('click', function() { // Live handler called.});1.4.0-1.4.2开始支持了,实例如下:$('.hoverme').live('mouseo....
分类:
Web程序 时间:
2014-07-21 10:19:10
阅读次数:
252
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.题解:转换的方法:从左往右扫描罗马字符,如果当前的字符对应的数字比上一个数字小,就直接加...
分类:
其他好文 时间:
2014-07-21 10:05:42
阅读次数:
223
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.题解:基本的罗马字符和数字对应如下表所示:罗马字符数字I1V5X10L50C100D50...
分类:
其他好文 时间:
2014-07-21 10:05:16
阅读次数:
286