最新评论

共2页: 1 2 下一页 
晓岚 2012-01-22 22:45
Baby 产房
郎涛 2009-06-24 20:08
类文件中可用 HttpContext.Current.Server.MapPath()
丁学 2009-01-01 00:26
已经过去快半个小时了~~
niu 2008-11-09 10:33
MySQLConnectionString构造函数的server参数谁什么?可以是IP吗?
新手11223sdfsd 2008-07-29 13:20
public class MaxSubArray
...{
public static void main(String[] args)
...{
ArrayList<int[]> testData = new ArrayList<int[]>();
//这是一些测试用的数组
testData.add(new int[]...{-7,15,2,-5,12,6,-26});
testData.add(new int[]...{1});
testData.add(new int[]...{12, -8, 5, 66, -21, 0,35, -44,7});
testData.add(new int[]...{-100,-100,-100,-100,100});
testData.add(new int[]...{3,73,-95,42,43,29,-30,-87,74,-53,22,74,-91,-1,-27,-8,-14,26,-67,-74});
testData.add(new int[]...{12, -8, 71, -21, 35, -44,7 ,-2000,1999});
testData.add(new int[]...{98,99,-2,-99,100,-99,-2});
testData.add(new int[]...{-2, 11, -4, 13, -5, -2});
testData.add(new int[]...{-1});

for(int[] array:testData)
...{
System.out.println(Arrays.toString(array));
System.out.println("result:"+findMaxSubArray(array));
System.out.println();
}
}

static private SubArray findMaxSubArray(int[] intArray)
...{
//去头,去尾
int bIndex = 0,eIndex = intArray.length-1;
while(intArray[bIndex]<=0 && bIndex+1<intArray.length)...{bIndex++;}
while(intArray[eIndex]<=0 && eIndex-1>=0)...{eIndex--;}

LinkedList<SubArray> saList = new LinkedList<SubArray>();
for(int i=bIndex; i<=eIndex; i++)
...{
saList.add(new SubArray(i,intArray[i]));
}

//合并相邻的属性相似的数据
Iterator<SubArray> iter = saList.iterator();
if(iter.hasNext())
...{
SubArray a = iter.next();
while(iter.hasNext())
...{
SubArray b = iter.next();
if((a.getSum()>=0 && b.getSum()>=0)||(a.getSum()<=0 && b.getSum()<=0))
...{
a.m(b);
iter.remove();
}
else
...{
a = b;
}
}
}

//跨区段合并更大范围的数据
SubArray[] array = new SubArray[saList.size()];
array = saList.toArray(array);
if(array.length>=3)
...{
for(int i=1;i<array.length; i+=2)
...{
SubArray a = array[i-1];
SubArray b = array[i];
SubArray c = array[i+1];
int sum = a.getSum()+b.getSum()+c.getSum();
if( sum > a.getSum() && sum > c.getSum())
...{
a.m(b);
a.m(c);
array[i-1] = null;
array[i] = null;
array[i+1] = a;
}
}
}
//找到sum值最大的一段
SubArray maxSubArray = null;
for(int i=0;i<array.length; i++)
...{
if(null!=array[i])
...{
if(null==maxSubArray || array[i].getSum()>maxSubArray.getSum())
...{
maxSubArray = array[i];
}
}
}
return maxSubArray;
}

/** *//**
* 为了记录原始下标而建立的 子数组 对象
* @author 顾法华,杭州
*
*/
static private class SubArray
...{
int head = -1;
LinkedList<Integer> content;

SubArray(int head,LinkedList<Integer> subArray)
...{
this.head = head;
this.content = subArray;
}

SubArray(int head,int v)
...{
this(head,new LinkedList<Integer>());
content.add(v);
}

public void m(SubArray sa)
...{
content.addAll(sa.content);
}

public int getSum()
...{
int s = 0;
for(int i : content)
...{
s += i;
}
return s;
}

public String toString()
...{
return this.getSum()+" ("+head+"~"+(head+content.size()-1)+") "+content.toString();
}
}
}
//找到这个你看看
新手11223sdfsd 2008-07-29 13:16
不对。。

我运行了一下
the max sum for sub array:
18
new sum array m:
1 -1 3 13 9 16 18 13
max sub array:-2 10 -4 7 2 -5

没看懂
nengrenju 2008-05-21 22:36
hao
铁山 2008-05-16 16:30
顶顶 学习学习
AnselZheng 2008-01-08 10:55
谢谢,我想请问下如何避免孤立用户的产生?有什么方法吗?谢谢。
书生多命贱 2007-12-06 15:23
@ddr888
EventLog 需要引入 System.Diagnostics名称空间!
asdasd 2007-11-01 18:58
couid not load intializatiom file
syw 2007-10-17 17:12
’| 赤;焰﹏゛
李赛钰 2007-09-19 16:33
when you feel the slip
when you start to crack
when it's all to hell
know i have your back
whether right or wrong
is beside the point
'cause we're more than blood
飒飒 2007-09-19 13:44
当爱情已经不再回来不知道什么时候才可以找到下一个你?
郭韬 2007-09-19 13:40
郭韬
邓林海 2007-09-17 17:15
那确实
gm 2007-07-11 16:27
Server.Mapth("/")提示找不到目录
马可香蕉 2007-06-08 17:00
收藏
12 2007-05-21 01:16
傻子
ddr888 2007-05-17 17:57
String LogName = "Application";
8 if (!EventLog.SourceExists(LogName))
9 {
10 EventLog.CreateEventSource(LogName, LogName);
11 }

为什么我在global里面写的 相似的功能不能创建相应的时间日志来源 ,
但是我又重新写个winform的同样的代码就可以用?
4545 2007-04-26 19:13
Well I wonder could it be
When I was dreaming about you baby
You were dreaming of me
Call me crazy
Call me blind
To still be suffering is stupid after all of this time

Did I lose my love to someone better
And does she love you like I do
I do, you know I really really do

Well hey
So much I need to say
Been lonely since the day
The day you went away

So sad but true
For me there's only you
Been crying since the day
the day you went away

I remember date and time
September twenty second
Sunday twenty five after nine
In the doorway with your case
No longer shouting at each other
There were tears on our faces

And we were letting go of something special
Something we'll never have again
I know, I guess I really really know

Why do we never know what we've got till it's gone
How could I carry on the day you went away
Cause I've been missing you so much I have to say

gfhg 2007-04-15 14:15
dsfdsgdsg
Clark Zheng 2007-04-05 20:59
上面都是些什么垃圾回复呀。。。不过随笔内容不错,我收着了,谢谢
代红 2007-04-02 15:33
内容提要: 老舍先生由于其苦难的人生、没落满族旗人的特殊身份,以及“五四”文化运动所带来的影响,使老舍的作品自然而然的蒙上了一层悲剧的色彩。本文将从个体人生的悲剧和民族文化的悲剧两个方面来论述老舍小说的悲剧性。在个体人生的悲剧中,不论是从满怀理想到最终堕落的人,以生命为赌注同命运抗争的人,还是无所顾及屈服命运者,不论作者对他们表现出同情、赞赏或批评之情。他们的人生终究还是逃不了一个“悲”字。而随着“老字号”、“老”民族精神的幻灭,揭示了民族文化的悲剧。作品中赞扬了传统的美德的同时,更加揭示了一些旧思想、旧观念对民族进步所造成的阻碍。
16 2007-03-20 14:55
FADFSAFKSJKF][S
D
111 2007-03-19 04:32
承诺
CoffeeCat 2007-03-18 13:27
谢谢!
hchl 2007-03-15 15:32
刚开始学习AJAX,看此文受益非浅!
张刚 2007-03-10 14:33
"you are the best one in my mind " 请问这是仕么意思啊????
用中文给我翻页一下好吗?
张刚 2007-03-10 14:28
darling 用中文是仕么意思啊,请问??????
dddd 2007-02-13 15:08
tyurtutyuyrtyur
dddd 2007-02-13 15:08
ytrutyurtyuyturt
dddd 2007-02-13 15:07
hgjghjghjfghj
dddd 2007-02-13 15:07
dfsfasdfasdfdsa@dddd
dddd 2007-02-13 15:06
@dd
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
dddd 2007-02-13 15:05
ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
dddd 2007-02-13 15:05
ddddddddddddddddd
dd 2007-02-13 15:05
dfgsdgasdg
123 2007-01-28 18:11
谢谢
UMBN 2007-01-28 11:08
LY GIRE
wang 2007-01-25 04:47
知道吗
王言 2006-12-31 20:45
Bond!James bond!'
王言 2006-12-31 20:44
Bond!James dond
王言 2006-12-31 20:42
@fgf
李朝 2006-12-31 02:06
简单的介绍了自动控制的发展史 ,从公元前14世纪至今,自动控制在不段发展,在1868年至今的短短一百年中,自动控制理论无论在深度和广度上都得到了令人吃惊的发展。
晓岚 2006-12-14 08:16
是不是每步操作都是事件驱动的呢?
如果不是
那那些方法是由谁驱动的
如果是
这些事件都是在哪定义的
小贝[匿名] 2006-12-09 18:43
欢迎马来西亚客人用英语怎么说
小贝[匿名] 2006-12-09 18:42
欢迎马来西亚客人
小贝[匿名] 2006-12-09 18:41
欢迎马来西亚客人
中国工商黄页网 2006-12-09 16:18
中国工商黄页网
www.firm114.com
共2页: 1 2 下一页