Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Cuks {
- static int count = 0;
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- System.out.print("Matrix Size: " );
- int number = scan.nextInt();
- int[][] matrix = new int[number][number];
- calculate(matrix,0 ,0);
- System.out.println("Tracks: "+count);
- } //end of main
- public static void calculate(int[][] matrix, int row, int colum){
- if(row == matrix.length -1&& colum == row){
- count++;
- }
- if(row < matrix.length - 1){
- calculate(matrix,row+1,colum);
- }
- if(colum < matrix.length -1){
- calculate(matrix,row,colum+1);
- }
- } //end of calculate
- } //end of class
Add Comment
Please, Sign In to add comment