First, design ideas
We then let him automatically generate 1000 random long numbers based on the first experiment. Roughly the same as the experiment, I have buried myself in a bomb.
Second, the experimental code
Package Com.minirisoft;import Java.util.*;class supermax{public static void Main (string[] args) {long[] list = new long[10 00];//input array is an array must be defined first, otherwise an error! long[] arr1 = new long[1000];//input array is an array that must be defined before an error occurs! System.out.println ("Enter array:"); for (int k=0;k<1000;k++) {random t=new random (); List[k]=t.nextlong (); if (k==500) list [500]= (Long) Math.pow (2,10000);} for (int n=0;n<999;n++) {arr1[n]=list[n];for (int m=n;m<999;m++) {arr1[m+1]=arr1[m]+list[m+1];} for (int m=n;m<1000;m++) {if (Arr1[m]>arr1[n]) {arr1[n]=arr1[m];}} System.out.println ("from" + (n+1) + "The maximum number of sub-arrays of radiation of elements and" +arr1[n]);} ARR1[999]=LIST[999]; System.out.println ("The maximum number of sub-arrays radiating from the 1000th element is" +arr1[999 "); for (int i=0;i<1000;i++) {if (arr1[i]>arr1[0]) {arr1[0]= Arr1[i];}} System.out.println ("Maximum subarray of" and "+arr1[0]);}}
Third, the experimental results
。
。
。
Iv. Experience
This experiment, let me know to consider the type of number, see whether cross-border. But now I feel very puzzled by my own procedure. It is obviously long length range to 2^64 but has received more than the number of times, but no error.
V. Panel members: Yang Guangxin, Guo Jianhao
Pair development Five--the maximum number of sub-arrays for a one-dimensional array of 1000-digit long type