上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 24 下一页
摘要: Fibonacci数列,快速幂 1 #include <cstdio> 2 struct Matrix{int a[5][5];}; 3 const int N=2,MOD=10007; 4 Matrix A,B,O,I; 5 Matrix Mul(Matrix A,Matrix B){ 6 Mat 阅读全文
posted @ 2020-02-27 21:53 墨鳌 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 我不理解为什么写dijkska就WA呢? atoi()是个好东西,给你个颜色,自己体会 疑惑!疑惑!疑惑! 1 #include <queue> 2 #include <cstdio> 3 #include <algorithm> 4 using namespace std; 5 const int 阅读全文
posted @ 2020-02-26 22:18 墨鳌 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 struct Matrix{int a[5][5];}; 3 const int N=2,MOD=1e4; 4 Matrix A,B,O,I; 5 Matrix Mul(Matrix A,Matrix B){ 6 Matrix C=O; 7 for(int 阅读全文
posted @ 2020-02-25 20:08 墨鳌 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 已知矩阵乘法是n^3的,必然超时 故可以在需要验证的等式AB=C两边同时左乘D 一个1xN的任意的不含0矩阵 设E=DA,F=EB,G=DC,则此时只需验证F=G 当匹配到非法列J时,跳出n^2寻找行I即可 记录一下Ans,C[I,J]的正确值,然后就愉快地AC了 为了偷懒,我使用的矩阵是A~G连续 阅读全文
posted @ 2020-02-25 13:07 墨鳌 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 构造矩阵 1 #include <cstdio> 2 const int MAXN=100; 3 struct Matrix{int a[MAXN][MAXN];}O,I;int N; 4 void OI(int n){N=n;for(int i=0;i<MAXN;i++)for(int j=0;j 阅读全文
posted @ 2020-02-25 10:57 墨鳌 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 矩阵快速幂,主要是考构造。另外,swap总是写龊? 为什么?干脆放弃了。唉,我太难了。 思路:操作e和s都很好想,主要是g操作 我们可以额外空出一位,记为1,每次要加1,就对这个额外的1进行计算即可 不妨定义A=[1 0 0 ... 0],此时只要构造一组操作的等效矩阵T就好了 就是添一位使初始矩阵 阅读全文
posted @ 2020-02-25 01:14 墨鳌 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef double db; 4 const db eps=1e-9; 5 db a,b,c,x,y; 6 db dis2(db X){ 7 db Y=a*X*X+b*X+c; 8 ret 阅读全文
posted @ 2020-02-24 16:57 墨鳌 阅读(299) 评论(0) 推荐(0) 编辑
摘要: 将军饮马问题的升级版 二维平面中要从A到D,给出两条线段AB,CD,分别在线段AB,CD,以及空白处的速度为P,Q,R 求最少用时 由于最优位置满足“凸性”,且两条线段可以等价,所以可以采取三分答案迭代的写法 值得注意的一点:求两点距离时开方运算会损失一部分精度,一种玄学的方法是在开方前用一个eps 阅读全文
posted @ 2020-02-24 16:27 墨鳌 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 真的打起比赛来,连个贪心都写不好,呜呜呜。 1 #include <bits/stdc++.h> 2 using namespace std; 3 int a[5],t,ans; 4 void IF(int&a){if(a)ans++,a--;} 5 void IF(int&a,int&b){if( 阅读全文
posted @ 2020-02-24 11:24 墨鳌 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 1 #include <cstdio> 2 typedef long long ll; 3 int quick_pow(ll a,ll b,ll mod){ 4 ll ans=1; 5 for(;b;a=(a*a)%mod,b>>=1)if(b&1)ans=(ans*a)%mod; 6 return 阅读全文
posted @ 2020-02-23 15:30 墨鳌 阅读(164) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 24 下一页