Teammate: http://home.cnblogs.com/u/Megau/
First, analysis
First, an array of length n is enlarged by twice times, that is, after the array is followed by an array of the same size, then the length is n, and the elements at the beginning of the array are the cells of the original array, forming n arrays. The n array is then followed by the maximum Subarray, and then the maximum and in this heap is found.
Second, the Code
str1="4-2 3-1-1"Print"Please enter an array"str1=raw_input () counter_1=0STR2=str1+" "+STR1STR2=Str2.split ()#Print str2counter_1=0 forIinchstr2:counter_1=counter_1+1counter_1=counter_1/2#Print counter_1answer_array=[0]*counter_1 forJinchRange (0,counter_1): Str3=str2[j:j+counter_1]#print "Str3", Str3sum_record_unexcept=0 Str3[0]=Int (str3[0]) Sum_constant_add=0 forIinchstr3:i=Int (i) sum_record_unexcept=Max (sum_record_unexcept,sum_constant_add) Sum_constant_add=max (sum_constant_add+i,i) Answer_array[j]=Max (sum_constant_add,sum_record_unexcept)#print "Answer_array[i]", Answer_array[j]#print "Answer", Answer_arrayMaxment=Answer_array[0] forIinchAnswer_array:if(maxment<i): Maxment=IPrint"The maximum value is", maxment
Three
Sub-array 2