Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main extends A{
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int [][] data = new int[1000][1000];
- int [] maxInRow = new int[1000];
- int [] maxInColumn = new int[1000];
- int [] countOfSymbols = new int[1000];
- int i = 0;
- for (; scanner.hasNext(); i++) {
- String tmp = scanner.nextLine();
- Scanner sc = new Scanner(tmp);
- for (int j = 0; sc.hasNext(); j++) {
- data[i][j] = sc.nextInt();
- countOfSymbols[i]++;
- if (maxInRow[i] < data[i][j]) {
- maxInRow[i] = data[i][j];
- }
- if (maxInColumn[j] < data[i][j]) {
- maxInColumn[j] = data[i][j];
- }
- }
- }
- for(int j = 0; j <= i; j++) {
- for(int k = 0; k < countOfSymbols[j]; k++) {
- System.out.print(Math.max(maxInRow[j], maxInColumn[k]) + " ");
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement