Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- //матрица смежности
- public class AdjacencyMatrix {
- private int Matrix[][];
- private int n;
- private int m;
- public AdjacencyMatrix(int n,int m)
- {
- Matrix=new int[n][m];
- this.n=n;
- this.m=m;
- }
- //считать матрицу с консоли
- public void consoleRead()
- {
- Scanner sc=new Scanner(System.in);
- for (int i=0;i<n;i++)
- for (int j=0;j<m;j++)
- Matrix[i][j]=sc.nextInt();
- }
- //вернуть элемент матрицы
- public int get(int i,int j)
- {
- return Matrix[i][j];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement