📄 exp1_5.java
字号:
import java.util.Scanner;
public class exp1_5 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int[][] a;
int col, row;
System.out.println("Please input col&row:");
Scanner in1 = new Scanner(System.in);
col = in1.nextInt();
Scanner in2 = new Scanner(System.in);
row = in2.nextInt();
a = new int[col][row];
for (int i = 0; i < col; i++)
for (int j = 0; j < row; j++)
a[i][j] = 0;
System.out.println("Please Input element of array:");
for (int i = 0; i < col; i++)
for (int j = 0; j < row; j++) {
Scanner tmp = new Scanner(System.in);
a[i][j] = tmp.nextInt();
}
int i, j, ii, jj, m = 0, n = 0,N=0;
for (i = 0; i < col; i++)
for (j = 0; j < row; j++) {
m = a[i][j];
for (ii = 0; ii < row; ii++)
if (m < a[i][ii]) {
n = -1;
break;
}
for (jj = 0; jj < col; jj++)
if (m > a[jj][j]) {
n = -1;
break;
}
if (n == -1) {
n = 0;
continue;
}
if (n == 0) {
System.out.println(m);
N++;
}
}
if (N == 1)
System.out.println("In total,There is " + N + " point.");
else if (N > 1)
System.out.println("In total,There are " + N + " points.");
else if (N == 0)
System.out.println("There is no point.");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -