
矩阵快速幂
矩阵快速幂
Guuuuuu老师儿
当初的算法竞赛题目博客的留言评论就不回复了,时间太久已经忘干净了,抱歉~
展开
-
垒骰子(25 point(s))(矩阵快速幂+快速幂)
垒骰子(25 point(s))赌圣atm晚年迷恋上了垒骰子,就是把骰子一个垒在另一个上边,不能歪歪扭扭,要垒成方柱体。经过长期观察,atm 发现了稳定骰子的奥秘:有些数字的面贴着会互相排斥!我们先来规范一下骰子:1 的对面是 4,2 的对面是 5,3 的对面是 6。假设有 m 组互斥现象,每组中的那两个数字的面紧贴在一起,骰子就不能稳定的垒起来。 atm想计算一下有多少种不同的可能的垒骰子方式...原创 2018-04-23 17:00:20 · 820 阅读 · 0 评论 -
Jzzhu and Sequences CodeForces - 450B(矩阵快速幂)
Jzzhu and Sequences CodeForces - 450BJzzhu has invented a kind of sequences, they meet the following property: You are given x and y, please calculate fn modulo 1000000007 (109 + 7). Input...原创 2018-09-08 08:32:09 · 215 阅读 · 0 评论 -
233 Matrix HDU - 5015(矩阵快速幂)
233 Matrix HDU - 5015 In our daily life we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233333 ... in the same meaning. And here is the question: Suppose we have a mat...原创 2018-09-07 19:38:02 · 188 阅读 · 0 评论 -
So Easy! HDU - 4565(构造共轭+矩阵快速幂)
So Easy! HDU - 4565A sequence S n is defined as: Sn=⌈(a+b√)n⌉%mSn=⌈(a+b)n⌉%mS_n = \lceil(a+\sqrt{b})^n\rceil\%mWhere a, b, n, m are positive integers.┌x┐is the ceil of x. For example, ┌3.14┐=4. Y...原创 2018-08-31 08:54:36 · 336 阅读 · 0 评论 -
graph HDU - 5607(矩阵快速幂+K步可达路径)
graph HDU - 5607In a directed graph which has N points and M edges,points are labled from 1 to n.At first I am at point u,at each step I will choose an output edge of the current point at uniform ra...原创 2018-08-31 10:12:08 · 328 阅读 · 0 评论 -
Number Sequence (正解:矩阵快速幂)
Number Sequence A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).Input The...原创 2018-07-28 11:15:39 · 3651 阅读 · 1 评论 -
Covering HDU - 6185 (找递推公式+矩阵快速幂)
Covering HDU - 6185 Bob's school has a big playground, boys and girls always play games here after school. To protect boys and girls from getting hurt when ...原创 2018-06-04 20:45:05 · 287 阅读 · 0 评论 -
Mistwald ZOJ - 3497 (矩阵快速幂)
Mistwald ZOJ - 3497 In chapter 4 of the game Trails in the Sky SC, Estelle Bright and her friends are crossing Mistwald to meet their fi...原创 2018-04-21 18:09:36 · 267 阅读 · 0 评论 -
Just Pour the Water ZOJ - 2974 (矩阵快速幂)
Just Pour the Water ZOJ - 2974 Shirly is a very clever girl. Now she has two containers (A and B), each with some water. Every minute, she pours half of the...原创 2018-04-18 20:44:54 · 255 阅读 · 0 评论 -
Reading comprehension HDU - 4990(打表找递推式+矩阵快速幂)
Reading comprehension HDU - 4990 Read the program below carefully then answer the question.#pragma comment(linker, "/STACK:1024000000,1024000000")#include <cstdio>#include<iostream>#...原创 2018-09-08 09:33:51 · 220 阅读 · 0 评论