题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo....
分类:
编程语言 时间:
2014-08-04 04:10:26
阅读次数:
374
HDU 4002 Find the maximum(数论-欧拉函数)
题目大意:
给定一个n,问你1~n中,求一个数 x 使得 x/φ(x) 的值最大。
解题思路:
根据欧拉函数的公式,φ(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…..(1-1/pn)
则:x/φ(x)=p1/(p1-1)*p2/(p2-1)*......*pn/(pn-1)
可以看出项越多x/φ(x)越大,且因子越小x/φ(x)越大,那么只需要2*3*5*7....
考虑到数字很大,所以用JAVA来写...
分类:
其他好文 时间:
2014-08-03 23:16:46
阅读次数:
268
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.
/**
* Definition for binary tree
...
分类:
其他好文 时间:
2014-08-02 23:32:04
阅读次数:
232
Delay Constrained Maximum Capacity Path
Time Limit:10000MS Memory Limit:65535KB 64bit IO Format:%I64d
& %I64u
Submit Status
Description
Consider an undirected graph with N vert...
分类:
其他好文 时间:
2014-08-02 18:31:43
阅读次数:
313
解题报告
题目传送门
题意:
有N个点,点1为珍贵矿物的采矿区, 点N为加工厂,有M条双向连通的边连接这些点。走每条边的运输容量为C,运送时间为D。
他们要选择一条从1到N的路径运输, 这条路径的运输总时间要在T之内,在这个前提之下,要让这条路径的运输容量尽可能地大。
一条路径的运输容量取决与这条路径中的运输容量最小的那条边。
思路:
二分容量建图,spfa判时间是否符合...
分类:
其他好文 时间:
2014-08-02 18:31:13
阅读次数:
375
题目链接:点击打开链接
#include
#include
#include
using namespace std;
#define INF 0x3f3f3f3f
#define eps 1e-8
#define pi acos(-1.0)
typedef long long ll;
int main()
{
int i, j;
double m,n;
while...
分类:
其他好文 时间:
2014-08-02 18:20:43
阅读次数:
233
问题:最大连续子窜和是多少分析:动态规划,定义max记录最大值,sum记录以i结束的连续子窜的最大值class Solution {public: int maxSubArray(int A[], int n) { int sum; int MAX=A[0]; ...
分类:
其他好文 时间:
2014-08-02 17:55:23
阅读次数:
191
输入n、m,表示一个n面的色子(面上的值为1-n),投掷m次,求得到的最大值的期望(1?≤?m,?n?≤?105)....
分类:
其他好文 时间:
2014-08-02 12:57:13
阅读次数:
189
题目链接题意:分析: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define LL long long 9 using namespace std;10 11 int ...
分类:
其他好文 时间:
2014-08-02 12:43:43
阅读次数:
217
题目: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...
分类:
编程语言 时间:
2014-08-02 09:50:13
阅读次数:
232