Software engineering knot Pair Job 03

Source: Internet
Author: User

Same group member (Zhang She Qi): http://www.cnblogs.com/1443188449qq/

Design ideas

In the case of negative numbers, to ensure that the size of the sub-array is the largest, then the smallest negative number is definitely not in the sub-array, we will be the smallest negative numbers as a breakpoint, placed in the first bit of the non-circular array, so that its previous numbers do not need to be considered first. For example: When the loop array is 1,2,-5,6,-1, the smallest negative number is-5, and we can break it into a non-circular array -5,6,-1,1,2. This makes it possible to work out the maximum and sub-arrays. If there are no negative numbers, it doesn't matter where to disconnect from, but for programming convenience, we still disconnect from the smallest number.

Source

ImportJava.util.Scanner; Public classmaxsum_2 { Public Static voidMain (string[] args) {//TODO auto-generated Method Stub        intMax,a; System.out.println ("Please enter the length of the number:"); Scanner SC1=NewScanner (system.in); intSize =Sc1.nextint (); intnum[]=New int[size]; intnum2[]=New int[size]; System.out.println ("Please enter a number:");  for(inti=0;i<size;i++) {Num2[i]=Sc1.nextint (); }        intMin=0,minnumber=num2[0];  for(inti=0;i<size;i++)        {            if(num2[i]<Minnumber) {min=i; Minnumber=Num2[i]; }        }         for(inti=0;i<size;i++) {Num[i]=num2[(i+min)%size]; } Max=num[0]; A=num[0];  for(inti=1;i<size;i++)        {            if(max+num[i]>=Num[i]) {                if(num[i]<0&&a<max+Num[i]) a=Max; Max=max+Num[i]; }            ElseMax=Num[i]; }        if(a>max) Max=A;    System.out.print (max); }}

Run results

The process of cooperation

After discussing the specific requirements of this procedure, the same group of classmates (Zhang She Qi) did a program analysis, and completed code programming, reportedly lasted 16 minutes. After I read the program carefully, I tested it separately based on the different array values, and the results were correct.

Experience

Two people's cooperation can avoid weaknesses and accomplish tasks faster. Of course, at any time to improve their ability to grow slowly. (The most efficient team member may be a level equivalent of two people)

How to resolve conflicts

When you have different opinions about the same problem, don't think your own is the best, try to understand each other's ideas. Mutual understanding, mutual tolerance, the concession should be concessions.

Cooperation PHOTOS:

Software engineering knot Pair Job 03

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.