Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line思路:最多的点,必然是点连成线时,所有斜率相同的最多的组合情况; 那么如果不在同一直线点的组合也可能斜率.....
分类:
其他好文 时间:
2014-09-20 02:14:26
阅读次数:
270
题目:求不超过n的最大的x/φ(x),其中φ(x)是欧拉函数。
分析:数论,大整数。比赛时直接打表计算的。
实际上:φ(n)= n *(1 - 1/p1)*(1 - 1/p2)*(1 - 1/p3)*…*(1 - 1/pt);
所以有:x/φ(x)= 1 /((1 - 1/p1)*(1 - 1/p2)*(1 - 1/p3)*…*(1 - 1/pt)...
分类:
其他好文 时间:
2014-09-18 18:58:14
阅读次数:
148
题目:找到一个序列中的两个连续段使得他们的和最大。
分析:dp,最大字段和。双向求最大字段和,枚举结束点找到加和最大值。
说明:与合唱队形类似。(同poj2593)(2011-09-24 02:09)
#include
#include
int data[ 50005 ];
int asum[ 50005 ];
int bsum[ 50005 ];
void msum( int *D...
分类:
其他好文 时间:
2014-09-17 21:53:22
阅读次数:
233
题目 Given a string s,find the longest palindromic substring in S.You may assume that the maximum length of S is 1000,and there exist one unique longes....
分类:
其他好文 时间:
2014-09-17 21:46:02
阅读次数:
238
题目:
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
AC率第二高的题啦,二项树的最长路径。初看此题...
分类:
其他好文 时间:
2014-09-17 20:26:52
阅读次数:
162
for ($i = 0; $i -lt 100; $i++){$progressbar1.Minimum = 0$progressbar1.Maximum = 99$progressbar1.Value = $i#Start-Sleep 1}
分类:
其他好文 时间:
2014-09-17 11:57:32
阅读次数:
155
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2014-09-16 00:15:49
阅读次数:
196
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-09-15 15:46:19
阅读次数:
183
Given a binary tree, find the maximum path sum.
The path may start and end at any node in the tree.
For example:
Given the below binary tree,
1
/ 2 3
Return 6....
分类:
其他好文 时间:
2014-09-15 12:58:38
阅读次数:
168
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-09-14 12:49:37
阅读次数:
214