点击打开hdu1209
Problem Description
There is an analog clock with two hands: an hour hand and a minute hand. The two hands form an angle. The angle is measured as the smallest angle between the two ha...
分类:
其他好文 时间:
2015-08-02 06:28:04
阅读次数:
165
#include
using namespace std;
const int maxn = 1000000 + 10;
int T,n,m,k,Case = 0,a[maxn],cnt[maxn];
map p;
vector g[105];
int main() {
scanf("%d",&T);
while(T--) {
scanf("%d%d%d",&n,&...
分类:
其他好文 时间:
2015-08-01 10:07:38
阅读次数:
118
//用search计算左子树的节点个数,加上根节点本身若为k则输出,否则
//(1)若k大于目前个数,则k-左子树节点个数,再计算右子树
//(2)若k小于目前个数,则直接计算左子树
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;...
分类:
其他好文 时间:
2015-07-29 06:28:26
阅读次数:
117
Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallestto find the kth
smallest element in it.
Note:
You may assume k is always valid, 1 ≤ k ≤ BST's total elem...
分类:
其他好文 时间:
2015-07-26 15:52:22
阅读次数:
125
The smallest number expressible as the sum of a prime square, prime cube, and prime fourth power is 28. In fact, there are exactly four numbers below fifty that can be expressed
in such a way:
28...
分类:
其他好文 时间:
2015-07-23 21:50:50
阅读次数:
210
Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota...
分类:
其他好文 时间:
2015-07-23 13:47:56
阅读次数:
90
Given a binary search tree, write a function kthSmallest to find the kth
smallest element in it.
Note:
You may assume k is always valid, 1 ≤ k ≤ BST's total elements.
直观地一想,查找第k小的数,不就是...
分类:
其他好文 时间:
2015-07-22 16:22:04
阅读次数:
87
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:What if the BST is modifi...
分类:
其他好文 时间:
2015-07-19 16:32:18
阅读次数:
137
You have a positive integermand a non-negative integers. Your task is to find the smallest and the largest of the numbers that have lengthmand sum of ...
分类:
其他好文 时间:
2015-07-16 21:59:17
阅读次数:
144
Given a binary search tree, write a functionkthSmallestto find thekth smallest element in it.Note:You may assume k is always valid, 1 ≤ k ≤ BST's tota...
分类:
其他好文 时间:
2015-07-15 18:33:34
阅读次数:
80