Algorithm training to find the maximum time limit of the array: 1.0s memory limit: 512.0MB problem description for the given integer array a[], look for the maximum value, and return subscript. Input format integer array a[], the number of array elements is less than 1 equals 100. The output data is divided into two lines: the first row has only one number, representing the number of array elements, and the elements of the second behavior array. Output format output maximum value, and its subscript sample input 33 2 1 sample output 3 0 Solving ideas First assign value max=num[0],maxw=0, then the edge input edge to judge the change. Java code
Package looking for the maximum value in the array;
Import Java.util.Scanner;
public class Main
{public
static void Main (string[] args)
{
Scanner input=new Scanner (system.in);
int N=input.nextint ();
Int[] Num=new int[n];
Num[0]=input.nextint ();
int max,maxw;
MAX=NUM[0];
maxw=0;
for (int i=1;i<n;i++)
{
num[i]=input.nextint ();
if (Max<num[i])
{
max=num[i];
Maxw=i
}
}
System.out.println (max+ "" +maxw);
}