Powers of square matrices

Write a program that, given a square matrix M and a natural number n,
computes M^(n).

Input

The input consists of several cases. Each case consists of a natural
number n ≥ 0 followed by a natural number m > 0 and by m × m integer
numbers.

Output

For each case, print the elements of M^(n) in m lines following the
format of the example. Print a line with 10 dashes after every matrix.

Problem information

Author: Gabriel Valiente

Generation: 2026-01-25T15:51:41.384Z

© Jutge.org, 2006–2026.
https://jutge.org
