const int MAX=1010; //元素个数的最大值,根据题目修改int p[MAX];void init(int n) //n为实有元素个数{ for (int i=1; i<=n; i++) p[i]=i; }int find(int x) //查找{ if (x==p[x]) retu...
分类:
其他好文 时间:
2014-08-10 21:21:50
阅读次数:
258
Maximum SubarrayFind the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?...
分类:
其他好文 时间:
2014-08-10 21:18:20
阅读次数:
232
//1480#includeconst int MAX=50010; int p[MAX];int n,m;void init(int k) { for (int i=1; iconst int MAX=50010;int p[MAX];int n,m;void init(int k){fo...
分类:
其他好文 时间:
2014-08-10 21:15:20
阅读次数:
206
Description
Given a string of 0's and
1's up to
1000000 characters long and indices
i and
j, you are to answer a question whether all characters between position
min(i,j) and position
max(i,j...
分类:
其他好文 时间:
2014-08-10 18:47:30
阅读次数:
277
Consider integer numbers from 1 to n. Let us call the sum of digits of an integer number its weight. Denote the weight of the number x as w(x).
Now let us order the numbers using so called graduated ...
分类:
其他好文 时间:
2014-08-10 18:47:20
阅读次数:
406
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2121
题意:n个顶点,m条边,求从某一点起建立有向图最小生成树并且花费最小,输出最小花费和根节点下标。
思路:这道题根是不确定的,我们可以先假设一个根,从这个根出发到任何一点的距离(sum)都比原图总权值还大,这样保证了虚拟的边不会是最小入边,也为之后判断是否生成了最小树形图提供方便,从这个点...
分类:
其他好文 时间:
2014-08-10 18:45:40
阅读次数:
271
有N * N个格子,每个格子里有正数或者0,从最左上角往最右下角走,只能向下和向右,一共走两次(即从左上角走到右下角走两趟),把所有经过的格子的数加起来,求最大值SUM,且两次如果经过同一个格子,则最后总和SUM中该格子的计数只加一次。求SUM的最大值...
分类:
其他好文 时间:
2014-08-10 18:45:20
阅读次数:
274
oracle安装程序自带的,你找找看。我的放在:开始菜单 → 所有程序 → OraDb10g_home1 → Application Development → SQL Plus或者你在cmd中敲:sqlplusw 也能启动。******************补充:如果你有windows上的ora...
分类:
数据库 时间:
2014-08-10 17:59:10
阅读次数:
223
public class MaxSubSeqSum {
/**
* 算法1,穷举搜索
*/
public static final int maxSubSeqSum1(int seq[]) {
int length = seq.length;
int sum = 0;
for (int i = 0; i < length; i++) {
for (int j = i;...
分类:
其他好文 时间:
2014-08-10 15:46:40
阅读次数:
221
思路1.
当前为n的面积如何与n-1相联系,dp[i][j]=max(dp[i-1][k]) , 0<k<=j
描述:i为方块个数,j为高度
但是此题目的数据对于高度太变态,h,1000000000 ,n,100000
所以不可行(一般计算机为Ghz 相当于1S十几亿运算)
思路2.
此题目寻找的最大面积,对于一个方块来说则是以自己为中心左右两端比自己高
的方块累计和与自己面积的乘积,取最大值。状态转移则可看作已知前面n-1个左边比自己
高的的位置l[i],则如果该下标对应的数据比自己还高,继续往下找。利...
分类:
其他好文 时间:
2014-08-10 13:09:30
阅读次数:
278