so depressed, I first put the teacher's questions to write out ;
Returns the and of the largest interconnected subarray in a two-dimensional integer array.
Requirements:
Enter a two-dimensional shaping array with positive numbers in the array and a negative number.
The maximum value for the and of all sub-arrays. The following is an example diagram:
Recently has been completely caught in the cycle of programming, I did not find their own direction, not much to say, directly on the problem: in the sub-array problem I think the basic is a sub-array of deformation, there should be no special changes, up to the difficulty up, but the basic ideas will not change, today I found the wrong, maybe I was wrong.
My idea: Look at the code on the Internet to find the inspiration: because I think the teacher in class to talk about the figure of the method some trouble, so I would like to use a one-dimensional array of methods AC. Start is to find the two-dimensional array of each one-dimensional array of the maximum sub-array of the starting point, and then see if it can be connected to the direct add, not even to find a way to link, and finally add a special situation, just fine. However, to really reconsider this vague to find a cost of the least path, I am dazed, this still need to use the figure to solve it. First put out the code, after the problem must be perfected, if there is good advice please @ me, thank you.
#include <iostream>using namespace std;void max_place (int row,int &max,int fl[],int &start,int &end); int main () {int a[100][100];int fl[100];int hang=0,lie=0;int start_k[100],end_k[100]; Defines a two-dimensional array where each start stop position int large[100];int max=0;int start=0,end=0; Positional parameter cout<< "Please enter array number of rows:" <<endl;cin>>hang>>lie; int I=0,j=0;for (i=0;i
Recent improvements, Thank you
Unicom sub-array maximum value design 03