摘要: 题目链接在知道算法的情况下,写了矩阵的算法去找循环节,跑了10来分钟没出结果。。。真心2B啊。。。好好理解这种利用循环节的优化。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <cstdlib> 6 using namespace std; 7 #define LL __int64 8 int len1 = 222222224,len2 = 183120; 9 LL p[3][3],mat[3][ 阅读全文
posted @ 2012-09-20 20:15 Naix_x 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目链接开始居然错以为是Fib,其实是Trib,对矩阵加深了一下认识,F(n) = F(n-1)+F(n-2)+F(n-3) 初始矩阵变为3阶了。幂模依旧很搓,搜很多个版本,基本上都是运算符重载的,还有调用数组名的,当然也有直接运算的,凑合着用吧。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <cstdlib> 6 using namespace std; 7 #define MOD 10000 阅读全文
posted @ 2012-09-20 14:00 Naix_x 阅读(393) 评论(0) 推荐(0) 编辑