随笔分类 - 数论_矩阵快速幂
摘要:Description Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. Given a n × n matrix A and a positive integer k, f
阅读全文
摘要:Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci s
阅读全文
摘要:Problem Description A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。 Input 数据的第一行是一个T,表示有T组数据。每组数据的第一行有n(2 <= n <= 10)和k(2 <= k < 10^9)两个数据。接下来有n行,每行有n
阅读全文