Trooped Programming Summary

Source: Internet
Author: User

I. Title: returns the and of the largest sub-array in an integer array.

two. Requirements: Enter an array of shapes, there are positive numbers in the array and there are negative values.

One or more consecutive integers in an array make up a sub-array, each of which has a and.

The maximum value for the and of all sub-arrays. Requires a time complexity of O (n).

three. Pair programming requirements: two pairs to complete the programming task.

One person is mainly responsible for program analysis, code programming. One person is responsible for code review and Code test plan.

Publish a blog post about the process, experience, and how to resolve conflicts between two people (attach a work photo of the development).

Four. Team member: Kong Weichun, Cui Peng

Five. Cooperation Process and experience:

I and Tripenberg two people take charge of the procedure, analysis Code programming and code review, code test, strengthen the cooperative programming ability, have a great promotion to oneself, when conflict, first through mutual exchange views to seek common ground, and then from the online access to data or actual programming, choose the most appropriate method, ideas.

Six. SOURCE program code

ConsoleApplication3.cpp: Defines the entry point of the console application.
#include "stdafx.h"
int _tmain (int argc, _tchar* argv[])
{
return 0;
}
#include <iostream>
using namespace Std;
#include <stdlib.h>
#include <time.h>
int main ()
{
int i;
int a[10];
int max = 0;
int b = 0;

Srand (Time (NULL));
cout << "array is:";
for (i = 0; i<10; i++)
{
A[i] = rand ()% 201-100; Randomly generated-integers from 10 to 10
}
for (i = 0; i<10; i++)
{
cout << A[i] << "";
}
cout << Endl;

for (i = 0; i <; i++)
{
B + = A[i];
if (b < 0)
b = 0;
if (b > Max)
max = b;
}
if (max = = 0)
{
max = a[0];
for (i = 0; i <; i++)
{
if (Max < a[i])
{
max = A[i];
}
}
}
cout << "Maximum sub-array:" << max << Endl;
System ("pause");
return 0;
}

Seven. Results

Trooped Programming Summary

Related Article

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.