5.实现文件复制 1 int CopyFile(char *SourceFile,char *NewFile) 2 { 3 ifstream in; 4 ofstream out; 5 in.open(SourceFile,ios::binary);//打开源文件 6 ...
分类:
数据库 时间:
2014-11-21 10:27:07
阅读次数:
293
一:起因
(1)STL中关于二分查找的函数有三个:lower_bound 、upper_bound 、binary_search —— 这三个函数都运用于有序区间(当然这也是运用二分查找
的前提),下面记录一下这两个函数;
(2)ForwardIter lower_bound(ForwardIter first, ForwardIter last,const _Tp& val)算法返回一个...
分类:
其他好文 时间:
2014-11-20 23:47:22
阅读次数:
152
题目大意:给你一个m*n的方格,方格从(1,1)开始。每个点上有一棵树,然后让你从(0,0)点向下看,问你能看见几颗树。
解题思路:如果你的视线被后面的树和挡住的话以后在这条线上的树你是都看不见的啊。挡住的话就是这个小的方格内对角线的连线过顶点,如图:
建设A为(0,0)如果B能遮挡住C,那么B与C组成的矩形中nx, mx是不互质的。
所以x从1开始枚举n如果m中某一项与x互质那么就...
分类:
其他好文 时间:
2014-11-20 20:25:18
阅读次数:
245
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".Solution: 1 public class Solution { 2 publi...
分类:
其他好文 时间:
2014-11-20 18:18:52
阅读次数:
206
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,3,2].
Note: Recursive solutio...
分类:
其他好文 时间:
2014-11-20 17:05:34
阅读次数:
205
Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which rep...
分类:
其他好文 时间:
2014-11-20 15:06:39
阅读次数:
212
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 andsum =...
分类:
其他好文 时间:
2014-11-20 14:54:26
阅读次数:
230
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.二分递归转换Hide TagsTreeDepth-first Search/** * Definition...
分类:
其他好文 时间:
2014-11-20 13:40:54
阅读次数:
171
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...
分类:
其他好文 时间:
2014-11-20 13:39:29
阅读次数:
113
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 sum.Ja...
分类:
其他好文 时间:
2014-11-20 13:30:27
阅读次数:
120