/** */ /** * 神州数码笔试题目 * 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