Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.Th...
分类:
其他好文 时间:
2014-08-05 09:43:39
阅读次数:
191
欧拉回路第一题TVT本题的一个小技巧在于:【建立一个存放点与边关系的邻接矩阵】1.先判断是否存在欧拉路径无向图:欧拉回路:连通 + 所有定点的度为偶数欧拉路径:连通 + 除源点和终点外都为偶数有向图:欧拉回路:连通 + 所有点的入度 == 出度欧拉路径:连通 + 源点 出度-入度=1 && 终点 入...
分类:
其他好文 时间:
2014-08-04 23:57:58
阅读次数:
588
Til the Cows Come Home
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 29539
Accepted: 9927
Description
Bessie is out in the field and wants to get back to...
分类:
其他好文 时间:
2014-08-04 21:37:48
阅读次数:
361
Description
ACM has bought a new crane (crane -- je?áb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th segment is joined to the beginning o...
分类:
其他好文 时间:
2014-08-04 17:55:37
阅读次数:
240
Problem DescriptionThere is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Although th...
分类:
其他好文 时间:
2014-08-04 17:32:07
阅读次数:
290
Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from th...
分类:
其他好文 时间:
2014-08-04 13:50:57
阅读次数:
208
I -MooFestTime Limit:1000MSMemory Limit:30000KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionEvery year, Farmer John's N (1 2 #include 3 #inclu....
分类:
其他好文 时间:
2014-08-03 23:10:16
阅读次数:
331
L -KiKi's K-NumberTime Limit:2000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionFor the k-th number, we all should be very ...
分类:
其他好文 时间:
2014-08-03 23:10:06
阅读次数:
312
E -CowsTime Limit:3000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionFarmer John's cows have discovered that the clover gro...
分类:
其他好文 时间:
2014-08-03 23:02:16
阅读次数:
318
背景 Background农民John有很多牛,他想交易其中一头被Don称为TheKnight的牛。这头牛有一个独一无二的超能力,在农场里像Knight一样地跳(就是我们熟悉的象棋中马的走法)。虽然这头神奇的牛不能跳到树上和石头上,但是它可以在牧场上随意跳,我们把牧场用一个x,y的坐标图来表示。描述...
分类:
其他好文 时间:
2014-08-03 20:31:05
阅读次数:
297