定义f(x)为斐波那契数列第x项 输出f(f(x))%1000000007; x<=10^100; 思路: 矩阵快速幂+各种神奇的模; 来,上代码: ...
分类:
其他好文 时间:
2017-04-05 21:18:51
阅读次数:
177
生成一个新矩阵,多用一些参数吧这次: x <- c(12,13,14,15) rname <- c("R1","R2") nname <- c("C1","C2") newmatrix <- matrix(x,nrow=2,ncol=2,byrow=TRUE,dimnames=list(rname, ...
分类:
编程语言 时间:
2017-04-05 14:02:48
阅读次数:
204
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=4128 大水题一道 使用大步小步算法,把数字的运算换成矩阵的运算就好了 矩阵求逆?这么基础的线代算法我也不想多说,还是自行百度吧 需要注意的是矩阵没有交换律,所以在计算$B\cdot A^{-m ...
分类:
编程语言 时间:
2017-04-05 01:13:33
阅读次数:
225
转载自:http://blog.csdn.net/c914620529/article/details/50393223 在C#中使用mathnet,需要利用using引入相关类 矩阵运算的相关类: using MathNet.Numerics.LinearAlgebra.Double; using ...
分类:
Web程序 时间:
2017-04-04 23:22:07
阅读次数:
317
位运算简介及实用技巧(一):基础篇 什么是位运算? 程序中的所有数在计算机内存中都是以二进制的形式储存的。位运算说穿了,就是直接对整数在内存中的二进制位进行操作。比如,and运算本来是一个逻辑运算符,但整数与整数之间也可以进行and运算。举个例子,6的二进制是110,11的二进制是1011,那么6 ...
分类:
其他好文 时间:
2017-04-04 20:55:13
阅读次数:
503
Matrix-Tree 定理是解决生成树计数问题最有力的武器之一。它首先于 1847 年被Kirchhoff 证明。 在介绍定理之前, 我们首先明确几个概念: 1、 G 的度数矩阵 D[G]是一个 n*n 的矩阵, 并且满足: 当 i≠j 时,dij=0;当 i=j时, dij 等于 vi 的度数。 ...
分类:
其他好文 时间:
2017-04-04 18:37:45
阅读次数:
177
题意:给你一个n,输出Fibonacci (n)%10000的结果 思路:裸矩阵快速幂乘,直接套模板 代码: ...
分类:
其他好文 时间:
2017-04-02 19:56:45
阅读次数:
213
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? 先贴上自己丑陋的代码:主 ...
分类:
其他好文 时间:
2017-04-02 18:17:46
阅读次数:
198
题目链接:点击传送 MINSUB - Largest Submatrix no tags no tags You are given an matrix M (consisting of nonnegative integers) and an integer K. For any submatri ...
分类:
其他好文 时间:
2017-04-02 17:29:46
阅读次数:
173
1.三角函数 坐标轴采用右手法则,沿Z轴的逆时针方向为正角度,假设原始点为p(x,y,z),a是X轴旋转到点p的角度,r是从原始点到p点的距离。用这两个变量计算出点p的坐标,等式如下: x = rcos a; y = rsin a; 类似的可以使用r,a,b(p旋转的角度)来表示p'的坐标: x' ... ...
分类:
Web程序 时间:
2017-04-01 00:51:55
阅读次数:
1193