与‘数值-矩阵快速幂取模’有关的日志

poj3734

maksyuki 发表于 oj 分类,标签:
0
poj3734

Blocks

Panda has received an assignment of painting a line of blocks. Since Panda is such an intelligent boy, he starts to think of a math problem of painting. Suppose there are N blocks in a line and each block can be paint red, blue, green or yel >>继续阅读

poj3233

maksyuki 发表于 oj 分类,标签: ,
0
poj3233

Matrix Power Series

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  >>继续阅读

hdu4549

maksyuki 发表于 oj 分类,标签: ,
0
hdu4549

M斐波那契数列

Problem Description

M斐波那契数列F[n]是一种整数数列,它的定义如下:

F[0] = a

F[1] = b >>继续阅读

lightoj1131

maksyuki 发表于 oj 分类,标签:
0
lightoj1131

1131 - Just Two Functions

Find fn % M and gn % M. (% stands for the modulo operation.)Let fn = a1 * fn-1 + b1 * fn-2 + c1 * gn-3 gn = a2 * gn-1 + b2 * gn-2 + c2 * fn-3

Input

Input starts with an integer T (≤ 50), denoting the number of test cas >>继续阅读

lightoj1070

maksyuki 发表于 oj 分类,标签:
0
lightoj1070

1070 - Algebraic Problem

InputGiven the value of a+b and ab you will have to find the value of an+bna and b not necessarily have to be real numbers.

Input starts with an integer T (≤ 10000), denoting the number of test cases.

Each case contai >>继续阅读