Given preorder and inorder traversal of a tree,
construct the binary tree.Note:You may assume that duplicates do not exist in
the tree.思路:由前序遍历数组和中序遍历...
分类:
其他好文 时间:
2014-04-30 02:20:33
阅读次数:
366
16进制加法1 #include2 int main()3 {4 int a,b;5
while(scanf("%x %x",&a,&b)!=EOF)6 {7 printf("%d\n",a+b); 8 } 9 }
分类:
其他好文 时间:
2014-04-30 02:19:33
阅读次数:
357
friend numbers = 2^x + 3^y -1 1 #include 2 int
main() 3 { 4 __int64 a; 5 while(scanf("%I64d",&a)!=EOF) 6 { 7 if(!a) 8 {
9...
分类:
其他好文 时间:
2014-04-30 01:43:36
阅读次数:
322
项目中嵌入了IE控件,近期做了一次大改版,发现网页不能进行复制和剪切了,折腾了半天,发现是com初始化有问题:修正前的方式:CoInitialize(NULL);//
do your workCoUninitialize();修正后的方式:OleInitialize(NULL);// do your...
分类:
Web程序 时间:
2014-04-29 23:24:02
阅读次数:
509
求由所有的点组成的三角形中周长最小的三角形的周长1.将所有的点按横坐标大小排序2.从第一个点开始往后枚举,判断能否组成三角形,判断当前三角形周长是否小于已经得到的最小周长代码如下:#include#include#include#includeusing
namespace std;const do...
分类:
其他好文 时间:
2014-04-29 21:14:42
阅读次数:
504
题意:求N!中末尾0的个数 其实就是5的个数 因为2*5=10
肯定n中2的个数比5的个数多#includeusing namespace std;int main(){ int n; int t,d; int sum;
scanf("%d",&t); while(t...
分类:
其他好文 时间:
2014-04-29 21:09:41
阅读次数:
346
典型的快速幂成应用题意:求x 使得x^e%n=num#includeusing namespace
std;bool funtion(int x,int e,int n,int num){// m^n % k int b = 1; while (e >
0) { i...
分类:
其他好文 时间:
2014-04-29 20:20:25
阅读次数:
414
A LiveJournal course of developmentis a project
in the 99 years began in the campus, a few people do as a hobby such an
application, in order to achie...
分类:
其他好文 时间:
2014-04-29 19:38:16
阅读次数:
589
在串匹配模式中,KMP算法较蛮力法是高效的算法,我觉得其中最重要的一点就是求next数组:看了很多资料才弄明白求next数组是怎么求的,我发现我的忘性真的比记性大很多,每次看到KMP算法求next数组都得花很长时间去看怎么求,虽然看了很多遍了,但还是容易忘,所以我今天非得把它记下来,这样我下次看到的...
分类:
其他好文 时间:
2014-04-29 19:26:58
阅读次数:
429
2014-04-28
21:45题目:就地交换两个数,不使用额外的变量。解法:没说是整数,我姑且先当整数处理吧。就地交换可以用加法、乘法、异或完成,其中乘法和加法都存在溢出问题。三种方法都不能处理交换同一个数的情况,需要条件判断。代码:
1 // 17.1 Do a swapping in-plac...
分类:
其他好文 时间:
2014-04-29 17:19:40
阅读次数:
343