| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Announcement | Current Contest Past Contests Scheduled Contests Award Contest |
Matrix Power Series
Description Given a n ¡Á n matrix A and a positive integer k, find the sum S = A + A2 + A3 + ¡ + Ak. Input The input contains exactly one test case. The first line of input contains three positive integers n (n ¡Ü 30), k (k ¡Ü 109) and m (m < 104). Then follow n lines each containing n nonnegative integers below 32,768, giving A¡¯s elements in row-major order. Output Output the elements of S modulo m in the same way as A is given. Sample Input Sample Output Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2006 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator