摘要: 题目:http://poj.org/problem?id=3318题目中明确交代,0(n ^ 3) 会 TLE,可是一开始还就没看见,以为在计算矩阵时加两个优化可在 2s 挤过去呢,然后就TLE了三次,看别人的说是有一个结论 A * B * X == C * X时,有 A * B == C成立(成立的概率很大),然后 X 就是用随机函数求的View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <iostream> 4 #include <algorithm> 5 #incl 阅读全文
posted @ 2012-08-15 21:39 AC_Girl 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=3070算是矩阵快速幂的模板吧View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <iostream> 4 #include <algorithm> 5 #include <vector> 6 #include <math.h> 7 #define N 160 8 #define mod 10000 9 #define _clr(a,val) (memset(a,val,sizeof(a)) 阅读全文
posted @ 2012-08-15 21:29 AC_Girl 阅读(214) 评论(0) 推荐(0) 编辑