随笔分类 - 数论 - 矩阵快速幂
摘要:B . A prince of the Science Continent was imprisoned in a castle because of his contempt for mathematics when he was young, and was entangled in some
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/136/J来源:牛客网题目描述 洋灰是一种建筑材料,常用来筑桥搭建高层建筑,又称,水泥、混凝土。 WHZ有很多铸造成三角形的洋灰块,他想把这些洋灰三角按照一定的规律放到摆成一排的n个格子里,其中第i个格子放入的洋灰三角数
阅读全文
摘要:推荐博客 : https://blog.csdn.net/flushhip/article/details/80068888 百度文库 : https://wenku.baidu.com/view/dd6e9d00a58da0116d17491e.html 矩阵10大经典问题:http://www.
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/105/G来源:牛客网 题目描述 这是一个加强版的斐波那契数列。 给定递推式 求F(n)的值,由于这个值可能太大,请对109+7取模。 输入描述: 第一行是一个整数T(1 ≤ T ≤ 1000),表示样例的个数。以后每个
阅读全文
摘要: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 sequence are:
阅读全文
摘要:Jzzhu has invented a kind of sequences, they meet the following property: You are given x and y, please calculate fn modulo 1000000007 (109 + 7). Inpu
阅读全文
摘要:这里先引入一个快速幂 正常我们计算 x^22次方的话,要怎么去计算,暴力的话平方22次,这里想一个简单的方法,x^22要怎么计算出来, x^22 = x^16 * x^4 * x^2,折几个数怎么来的呢 ? 将22转换为 2进制的数 10110 ,正好不就是2^4 = 16, 2^2 = 4, 2^
阅读全文