100% Guaranteed Results


COMP 1011 Programming Fundamentals Solved
$ 20.99
Category:

Description

5/5 – (1 vote)

Laboratory Seven: Array
Problem: Matrix Power
Problem description
The power of a square matrix An is defined as follows:

I is an identify matrix (https://en.wikipedia.org/wiki/Identity_matrix).
Design a function as follows to calculate the power of a square matrix under a given module base. void matrix_power(int A[][N], int d, int n, int x, int res[][N])
• Input & output requirements
Input the dimension d, the matrix A, the power n and the module base x.
Note that 2 <= d <= 50, 0 <= n <= 1000, 2 <= x <= 104 and 0 <= A[i][j] <= 100 for any 0 <= i, j < d.
Ouput the An mod x.
• Sample results
Sample Input I:
2
1 1
1 1
0 10
Sample Ouput I:
1 0
0 1
Sample Input II:
5
1 2 3 4 5
6 7 8 9 1
1 2 3 4 5
4 5 6 7 8
6 7 8 9 1
1000 1007
Sample Ouput II:
142 432 722 5 360
889 786 683 580 530
142 432 722 5 360
970 772 574 376 504
889 786 683 580 530

Reviews

There are no reviews yet.

Be the first to review “COMP 1011 Programming Fundamentals Solved”

Your email address will not be published. Required fields are marked *

Related products