kimjava
发贴: 2
积分: 0
|
于 2006-11-03 03:05
import java.io.*; class Input{ static String s=""; static String input(){ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); try{ s=br.readLine();
}catch(IOException e){} return s; } static public int getInt(){ s=input(); int m=Integer.parseInt; return m; } } class CMatrix{ int[][] a=new int[4][5]; int row=0,col=0; int max = a[0][0]; CMatrix() { for(int i=0;i<a.length;i++) for(int j=0;j<a[0].length;j++) {a[i][j]=Input.getInt(); System.out.print(a[i][j]+"\t"); System.out.print("\n"); } } void find(){ for(int i=0;i<a.length;i++){ for(int j=0;j<a[0].length;j++)
if(a[i][j]>max) { max=a[i][j]; row=i; col=j; } }
System.out.println("the max :"+max); System.out.println("row="+row); System.out.println("col="+col); }
} public class Matrix{ public static void main(String[] args){ CMatrix c=new CMatrix(); c.find();
} }
|