归并排序的核心Merge函数思想很经典! 1 #include 2 3 const int maxn = 1000010; 4 5 int a[maxn],b[maxn]; 6 7 int main() 8 { 9 int m,n;10 scanf("%d",&m);11 ...
分类:
其他好文 时间:
2015-03-05 12:13:22
阅读次数:
113
这题真是浪费了很多时间,想法也对了,转移到寻找第k小的元素上来,然后根据两个都是一排好序的数组,像类似算法导论中利用partition找到划分的q,但在这里,由于题目要求O(logn),所以这个找q的过程必须是常数时间,想了好久想不到一个常数时间的划分。最后在网上找到答案了:分析:我们现在设计一个求...
分类:
其他好文 时间:
2015-03-04 14:19:17
阅读次数:
93
#include#includeusing namespace std;int arr1[1000066];int arr2[1000066];int main(){ int n1,n2; scanf("%d",&n1); for(int i=0 ; i<n1 ; ++i) { sca...
分类:
其他好文 时间:
2015-03-04 00:54:16
阅读次数:
140
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 17} is 15. The...
分类:
其他好文 时间:
2015-03-03 18:41:32
阅读次数:
144
Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 17} is 15. The...
分类:
其他好文 时间:
2015-03-03 13:43:53
阅读次数:
168
[LeetCode] 004. Median of Two Sorted Arrays (Hard) (C++/Java/Python)...
分类:
编程语言 时间:
2015-02-28 00:18:25
阅读次数:
167
1029. Median (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard 作者CHEN, YueGiven an increasing sequence S of N integers, the median is the number at ...
分类:
其他好文 时间:
2015-02-22 16:54:17
阅读次数:
140
Description描述Find coordinates of any triangle ABC if it is know that |AB|=c, |AC|=b, |AM|=m, AM is a median of triangle.找到任何一个三角形ABC,使得它满足|AB| = c,|AC...
分类:
其他好文 时间:
2015-02-22 13:20:04
阅读次数:
140
中位数Median的性质:对于数字A[], 给一个值 T,求 Σ |A[i] - T|,当T = Median时,结果最小。数组中所有数和Median的差的绝对值之和最小。应用:TopCoder SRM 645DIV2-500平均数AVG的性质:数组中所有数和AVG的差的平方和最小。
分类:
其他好文 时间:
2015-02-16 07:52:43
阅读次数:
171
题目1004:Median时间限制:1 秒内存限制:32 兆特殊判题:否提交:14162解决:3887题目描述: Given an increasing sequence S of N integers, the median is the number at the middle position...
分类:
其他好文 时间:
2015-02-14 01:04:14
阅读次数:
219