Two elements of a binary search tree (BST) are
swapped by mistake.Recover the tree without changing its structure.Note:A
solution using O(n) space is ...
分类:
其他好文 时间:
2014-06-03 13:53:21
阅读次数:
309
bfs+优先队列。wa了N次,才发现可以停留等待楼梯变换方向。 1 #include 2
#include 3 #include 4 #include 5 using namespace std; 6 7 #define MAXNUM 55 8 9
typedef struct node...
分类:
其他好文 时间:
2014-06-03 13:26:06
阅读次数:
274
http://poj.org/problem?id=3270这道题就是给你一个无序序列转换成有序序列需要花费的代价最小,交换a和b代价为a+b; 1
#include 2 #include 3 #include 4 #define maxn 20000 5 using namespace st...
分类:
其他好文 时间:
2014-06-03 13:14:32
阅读次数:
272
题目描述On the planet Zoop, numbers are represented in
base 62, using the digits 0, 1, . . . , 9, A, B, . . . , Z, a, b, . . . , z
where A (base 62) = 10 ...
分类:
其他好文 时间:
2014-06-03 12:32:55
阅读次数:
267
显然母函数,有一个地方需要注意。当输入0时,只有一种方法,所以输出1。代码: 1
#include 2 #include 3 #include 4 #include 5 using namespace std; 6 int
c1[255][111], c2[255][111]; 7 main...
分类:
其他好文 时间:
2014-06-03 12:21:39
阅读次数:
242
(1)ATL如何使用模板类 1 #include 2 using namespace std; 3 4
class CBase 5 { 6 public: 7 CBase(){} 8 ~CBase(){} 9 10 void BaseMethod()11 {12
...
分类:
其他好文 时间:
2014-05-30 22:11:13
阅读次数:
342
http://poj.org/problem?id=1026这道题题意是给你一个置换群,再给你一个字符串,输出经过k次置换的字符串。 就是找循环节。 1
#include 2 #include 3 #include 4 #define maxn 3000 5 using namespace s...
分类:
其他好文 时间:
2014-05-30 21:45:37
阅读次数:
249
水题,不过要想0ms过还是有个技巧的:#include #include using
namespace std;int main(){ int score[101]; int t,t1,temp; while(cin>>t) {
//memset(score,...
分类:
其他好文 时间:
2014-05-30 16:53:11
阅读次数:
268
Given a linked list, determine if it has a
cycle in it.Follow up:Can you solve it without using extra space?/** *
Definition for singly-linked list. *...
分类:
其他好文 时间:
2014-05-30 16:08:05
阅读次数:
238
Given a linked list, return the node where the
cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it
without using extra space?/**...
分类:
其他好文 时间:
2014-05-30 15:59:56
阅读次数:
249