神州数码笔试题目(二)
2007-11-07 13:42
295 查看
/** *//**
* 神州数码笔试题目
* 2.有一百个整数,其中有负数,找出连续三个数之和最大的部分.
* 语言:实现语言 java
*
*/
public class MaxTest ...{
public int getThreeMax(int[] count)...{
int max = 0;
int j = -1;
for(int i=0;i<count.length;i++)...{
if((i + 2) < count.length)...{
if(count[i] < 0)...{
continue;
}
else if(count[i+1] < 0)...{
i = i + 1;
continue;
}
else if(count[i+2] < 0)...{
i = i + 2;
continue;
}
else...{
if(max < (count[i] + count[i+1]+count[i+2]))...{
max = (count[i] + count[i+1]+count[i+2]);
j = i;
}
}
}else...{
break;
}
}//end for
return j;
}
public static void main(String[] args)...{
MaxTest max = new MaxTest();
int[] count = ...{-3,4,6,8,-9,7,10,-6,20,-9};
int mark = max.getThreeMax(count);
if(mark == -1)...{
System.out.println("the count you do is not right");
}else...{
System.out.println(count[mark]);
System.out.println(count[mark+1]);
System.out.println(count[mark+2]);
}
}
}
//更多笔试题目:www.search.bdkey.com
相关文章推荐
- 2007年11月神州数码软件工程师(网络公司)招聘笔试题目
- 神州数码软件测试工程师笔试C语言题目详解
- 神州数码笔试题目
- 神州数码笔试题目
- gcd递归定理(某公司实习生招聘笔试题目)
- 一道笔试题目
- 腾讯2013年实习生笔试题目
- 阿尔卡特笔试题目之一
- 一些笔试题目和答案
- iOS(Objective-C语法)面试、笔试题目
- 松江某游戏公司笔试题目
- 2014.3.29 阿里巴巴 实习校招 笔试 题目及部分参考答案
- java笔试题目
- baidu笔试的2个题目题目一解析
- Java常见笔试面试题目深度剖析系列之:Java方法参数传递详解
- 2011-10-15腾讯校园招聘笔试题目与参考答案
- 程序员笔试经典题目拾粹001
- java笔试题目(持续更新)
- C/C++ 笔试、面试题目大汇总2
- 数据结构:树结构笔试题目