Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package multidimencionalArrays;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.Arrays;
- public class P04_TwoByTwoSquaresInMatrix {
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- String[] dim = reader.readLine().split("\\s+");
- int rows = Integer.parseInt(dim[0]);
- int cols = Integer.parseInt(dim[1]);
- char[][] matrix = new char[rows][cols];
- for (int row = 0; row < rows; row++) {
- char[] values = reader.readLine().toCharArray();
- for (int col = 0; col < cols; col++) {
- if (row != ' ' && col != ' ') {
- matrix[row][col] = values[col];
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment