
快速幂
鸩羽小夜
我是小垃圾,垃圾中的战斗圾
展开
-
HDU4686An Arc of Dream(矩阵构造****+矩阵快速幂+模运算)
An Arc of Dream is a curve defined by following function: where a0= A0 ai= ai-1*AX+AY b0= B0 bi= bi-1*BX+BY What is the value of AoD(N) modulo 1,000,000,007? Input There are mult...原创 2019-10-16 19:27:01 · 144 阅读 · 0 评论 -
UESTC278 Fibonacci(矩阵快速幂,模运算,模板,斐波那契)
In the Fibonacci integer sequence,F0= 0,F1= 1, andFn=Fn− 1+Fn− 2forn≥ 2. For example, the first ten terms of the Fibonacci sequence are: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … An alternati...原创 2019-10-05 18:11:36 · 142 阅读 · 0 评论 -
CodeForces363D Renting Bikes(贪心+二分)
A group ofnschoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them. The renting site offered themmbikes. The renting price is different for different bikes, ren...原创 2019-10-05 18:37:41 · 191 阅读 · 0 评论 -
HDU1575 Tr A(矩阵快速幂)
A为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。 Input 数据的第一行是一个T,表示有T组数据。 每组数据的第一行有n(2 <= n <= 10)和k(2 <= k < 10^9)两个数据。接下来有n行,每行有n个数据,每个数据的范围是[0,9],表示方阵A的内容。 Output 对应每组数据,输出Tr(A^k...原创 2019-10-09 18:38:43 · 142 阅读 · 0 评论