Medium Accuracy: 31.45% Submissions: 10724 Points: 4
Given a N x N matrix where every cell has some number of coins. Count number of ways to reach bottom right cell of matrix from top left cell with exactly K coins. We can move to (i+1, j) or (i, j+1) from a cell (i, j).
First line contains number of test cases T. For each test case, first line contains the integer value 'X' denoting coins, second line contains an integer 'N' denoting the order of square matrix. Last line contains N x N elements in a single line in row-major order.
Output the number of paths possible.
1 <=T<= 500
1 <= K <= 200
1 <= N <= 200
1 <= Ai <= 200