上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 56 下一页
摘要: Ford-Fulkerson方法:dfs实现 dfs 140ms #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #includ 阅读全文
posted @ 2017-05-21 15:57 walfy 阅读(210) 评论(0) 推荐(0)
摘要: 挑战上面的题目,感觉脑洞很大 分别找红蓝个数全为偶,全为奇,一奇一偶的个数ai,bi,ci 转移矩阵是| 2 1 0 |,是一个对称矩阵(会不会有什么联系。) | 2 2 2 | | 0 1 2 | #include<map> #include<set> #include<cmath> #inclu 阅读全文
posted @ 2017-05-20 18:51 walfy 阅读(248) 评论(0) 推荐(0)
摘要: 花了一个多小时终于ac了,有时候真的是需要冷静一下重新打一遍才行。 这题就是 |aod(n)| = |1 ax*bx ax*by ay*bx by*ay| |aod(n-1) | |an*bn | = |0 ax*bx ax*by ay*bx by*ay| |an-1*bn-1 | |an | = 阅读全文
posted @ 2017-05-20 18:27 walfy 阅读(152) 评论(0) 推荐(0)
摘要: 转移矩阵很容易求就是|0 1|,第一项是|0| |1 1| |1| 然后直接矩阵快速幂,要用到费马小定理 :假如p是质数,且gcd(a,p)=1,那么 a(p-1)≡1(mod p)。即:假如a是整数,p是质数,且a,p互质(即两者只有一个公约数1),那么a的(p-1)次方除以p的余数恒等于1(这东 阅读全文
posted @ 2017-05-20 14:33 walfy 阅读(213) 评论(0) 推荐(0)
摘要: 状态变化 (x,y,dx,dy,i) 表示i时刻熊站在(x,y)处速度向量(dx,dy)下一个状态是 ( 2x+y+dx+i , x+2y+dy+i , x+y+dx , x+y+dy , i+1 ) 为了方便可以把平面从(1,1)平移到(0,0) 这时速度需要+2 (因为速度每次+x+y x和y都 阅读全文
posted @ 2017-05-20 12:47 walfy 阅读(200) 评论(0) 推荐(0)
摘要: 这题太坑了。。。刚开始以为可以用|a+sqrt(b) 1|水过。。。结果tle,还一直想明明我logn的做法怎么可能tle。。 | 0 1| 实在无奈看的题解 (a+sqrt(b))^n=x+y*sqrt(b); (a+sqrt(b))^(n+1)=a*x+b*y+(x+a*y)*sqrt(b) 这 阅读全文
posted @ 2017-05-18 13:48 walfy 阅读(136) 评论(0) 推荐(0)
摘要: a^(n+2)+b^(n+2)=(a+b)*(a^(n+1)+b^(n+1))-a*b*(a^n+b^n) 坑爹的题目关系式都推出来了居然还是wa了。。。。。 不能只看p,q=0就退出,因为a,b不一定为0啊,卧槽,出题人简直就是个心机婊 还有n=0的情况要考虑 #include<map> #inc 阅读全文
posted @ 2017-05-17 16:48 walfy 阅读(162) 评论(0) 推荐(0)
摘要: 求A+A^1+...+A^n 转换一下变成|A E|,的n+1次方就是|A^(n+1) A^n+...+A+E| |0 E| | 0 E | 最后结果减去E就行了,还有一点就是-1之后可能会变成负数,所以要+10再%10 #include<map> #include<set> #include<cm 阅读全文
posted @ 2017-05-17 14:38 walfy 阅读(206) 评论(0) 推荐(0)
摘要: 题目看了半天没看懂,,就是把一个数列更新r次,每次更新就是计算和,就是每一个数,只要出现了的表号都要加上去,具体看代码 矩阵快速幂实现加速 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #inc 阅读全文
posted @ 2017-05-17 13:01 walfy 阅读(173) 评论(0) 推荐(0)
摘要: #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #include<cstdio> #include<iomanip> #include<cstdlib> #inc 阅读全文
posted @ 2017-05-17 10:38 walfy 阅读(215) 评论(0) 推荐(0)
上一页 1 ··· 43 44 45 46 47 48 49 50 51 ··· 56 下一页