Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 #includeintnext[10005];ints[1000005],p[10005];intn,m;void...
分类:
其他好文 时间:
2014-07-26 13:46:34
阅读次数:
297
Painting Storages
Time Limit: 2 Seconds Memory Limit: 65536 KB
There is a straight highway with N storages alongside it labeled by 1,2,3,...,N. Bob asks you to paint all storages with two...
分类:
其他好文 时间:
2014-07-26 02:48:17
阅读次数:
178
B. Power StringsTime Limit: 3000msMemory Limit: 65536KB64-bit integer IO format:%lld Java class name:MainGiven two strings a and b we define a*b to be...
分类:
其他好文 时间:
2014-07-26 01:25:26
阅读次数:
300
题目:如果采取暴力搜索,复杂度为O(n2),会超时解法1:构建Node类,存储输入的数据和它们的下标。用sort按升序排序(其中lambda可以写成一个返回值为bool类型的函数)。设置i和j,分别指向容器的头和尾。如果和大于target,尾向前移,如果和小于target,头向后移。直至找出和等于t...
分类:
其他好文 时间:
2014-07-26 00:31:46
阅读次数:
223
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-07-26 00:23:26
阅读次数:
242
在一个D维空间,只有整点,点的每个维度的值是0~n-1 。现每秒生成D条线段,第i条线段与第i维度的轴平行。问D条线段的相交期望。生成线段[a1,a2]的方法(假设该线段为第i条,即与第i维度的轴平行)为,i!=j时,a1[j]=a2[j],且随机取区间[0,n-1]内的整数。然后a1[i],a2[...
分类:
编程语言 时间:
2014-07-25 19:10:12
阅读次数:
290
Just Pour the WaterTime Limit: 2 Seconds Memory Limit: 65536 KBShirly is a very clever girl. Now she has two containers (A and B), each with some wat....
分类:
其他好文 时间:
2014-07-25 18:58:22
阅读次数:
374
Two SumGiven an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the...
分类:
其他好文 时间:
2014-07-25 03:15:41
阅读次数:
176
Merge Sorted ArrayGiven two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that i...
分类:
其他好文 时间:
2014-07-25 02:34:44
阅读次数:
162
题目链接:hdu 4873 ZCC Loves Intersection
题目大意:给出N,D,表示在一个D维的坐标上,坐标范围为0~N-1。在这个坐标系中有D条线段,分别平行与各个坐标轴,每秒会根据题目中的伪代码随机生成各个线段的位置。两条直线相交的话会得一分,问每秒得分的期望。
解题思路:总的情况(ND?1?C(2N))D,两条直线相交的得分C(2D)?s2?ND?2?(ND?2?...
分类:
其他好文 时间:
2014-07-24 23:05:34
阅读次数:
287