Description Your task is to divide a number of persons into two teams, in such a way, that: everyone belongs to one of the teams; every team has at le ...
分类:
其他好文 时间:
2016-08-17 23:05:54
阅读次数:
135
题目: Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. (Medium) 分析: 题目要求不使用乘除和模运算实现两个整数除法 ...
分类:
其他好文 时间:
2016-08-17 22:55:15
阅读次数:
218
题意:给出n个点和n-1条边,a到b的最大承载量为a和b之间承载量的最小值。以某一点为中心,求承载量之和的最大值。 由于a和b之间的承载量为它们之间承载量的最小值,所以先以两点之间的承载量从大到小排序。每次合并时有A,B两个集合,他们之间的承载量(cost)为当前最小,如果B合并到A,则A的总承载量 ...
分类:
其他好文 时间:
2016-08-12 11:40:49
阅读次数:
113
题意:求C(p,q)/C(r,s),4个数均小于10000,答案不大于10^8 思路:根据答案的范围猜测,不需要使用高精度。根据唯一分解定理,每一个数都可以分解成若干素数相乘。先求出10000以内的所有素数,用a数组表示唯一分解式中个素数的指数,求出每个分子部分的素因子,并且相应的素数的指数加一。分 ...
分类:
其他好文 时间:
2016-08-10 20:48:33
阅读次数:
102
Divide two integers without using multiplication, division and mod operator. If it is overflow, return 2147483647 Divide two integers without using mu ...
分类:
其他好文 时间:
2016-08-09 01:55:33
阅读次数:
142
It is not the mountain we conquer but ourselves. 我们征服的不是高山而是自己。 ...
分类:
Web程序 时间:
2016-08-08 21:04:43
阅读次数:
191
题意: 给出一组数列a,问能够尽可能多的分成几段,让每一段的每一位的前缀和均 >= 0 分析: 从后往前扫,将第 i 位看作为某段最后一位 1. 若末位数字 >= 0 ,则自成一段 2. 若末位数字 < 0 ,则向前扫直到末位前缀和 >= 0 因为 末位的前缀和 >= 0, 则每一位的前缀和均 >= ...
分类:
其他好文 时间:
2016-08-08 15:43:17
阅读次数:
164
It is not the mountain we conquer, but ourselvess. 我们征服的不是高山,而是我们自己。 Difficulties and obstacles, just like the mountains in the world, need to be conq ...
分类:
其他好文 时间:
2016-08-08 00:47:50
阅读次数:
118
题意:求一个序列的分段个数,使得每一段的前缀和为0; 分析:如果正向思维,那么解法是从前往后遍历,每遇到一个负数就向前遍历直到>=0(这样贪心保证了序列尽可能多),但是这样最坏的情况是n^2的,所以要逆过来来考虑,每遇到负数就向前加到>=0即可,然后边统计答案,在n的算法里计算出。(注意:前缀和可能 ...
分类:
其他好文 时间:
2016-08-07 12:30:33
阅读次数:
140
Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2232 Accepted Submission(s): 628 Problem Descript ...
分类:
其他好文 时间:
2016-08-07 09:40:21
阅读次数:
132