上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页
摘要: ll mult_mod(ll a,ll b,ll c) { a%=c; b%=c; ll ret=0,tmp=a; while (b) { if (b&1) { ret+=tmp; if (ret>c) { ret-=c; } } tmp<<=1; if (tmp>c) tmp-=c; b>>=1; } return ret; } ll pow_mod(ll a,ll n,ll mod) { ll 阅读全文
posted @ 2019-08-10 20:59 Snow_in_winer 阅读(164) 评论(0) 推荐(0) 编辑
摘要: All-one Matrices Beauty Values CDMA Explorer Gemstones Just Jump Distance 阅读全文
posted @ 2019-08-10 18:11 Snow_in_winer 阅读(441) 评论(0) 推荐(0) 编辑
摘要: Tree 阅读全文
posted @ 2019-08-09 20:31 Snow_in_winer 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 中国剩余定理分析 我们将“孙子问题”拆分成几个简单的小问题,从零开始,试图揣测古人是如何推导出这个解法的。 首先,我们假设n1是满足除以3余2的一个数,比如2,5,8等等,也就是满足3*k+2(k>=0)的一个任意数。同样,我们假设n2是满足除以5余3的一个数,n3是满足除以7余2的一个数。 有了前 阅读全文
posted @ 2019-08-09 08:58 Snow_in_winer 阅读(205) 评论(0) 推荐(0) 编辑
摘要: 题目描述 A string is perfect if it has the smallest lexicographical ordering among its cyclic rotations. For example: "0101" is perfect as it is the small 阅读全文
posted @ 2019-08-08 17:53 Snow_in_winer 阅读(174) 评论(0) 推荐(0) 编辑
摘要: #include //大整数 struct BigInteger { static const int BASE = 100000000;//和WIDTH保持一致 static const int WIDTH = 8;//八位一存储,如修改记得修改输出中的%08d bool sign;//符号, 0表示负数 size_t length; std::vec... 阅读全文
posted @ 2019-08-07 19:35 Snow_in_winer 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 【算法介绍】网络流常用于解决分配匹配等问题。其主要算法包括dinic和sap(isap)其中,Dinic是基于层次图的网络流模型,时间复杂度为O(n ^ 2 * m)【算法实现】1,先通过bfs,在有流量的条件下,找到从超级源点ST到超级汇点ED的最短路2,再通过dfs,在确保是最短路的条件下,找到 阅读全文
posted @ 2019-08-07 18:54 Snow_in_winer 阅读(247) 评论(0) 推荐(0) 编辑
摘要: Salty Fish Support or Not Three Investigators Milk Candy Ridiculous Netizens Stay Real TDL Snowy Smile Faraway Nonsense Time Speed Dog 11 Dimensions 阅读全文
posted @ 2019-08-07 17:57 Snow_in_winer 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 无聊的数列 题目描述 维护一个数列{a[i]},支持两种操作: 1、1 L R K D:给出一个长度等于R-L+1的等差数列,首项为K,公差为D,并将它对应加到a[L]~a[R]的每一个数上。即:令a[L]=a[L]+K,a[L+1]=a[L+1]+K+D, a[L+2]=a[L+2]+K+2D…… 阅读全文
posted @ 2019-08-07 10:15 Snow_in_winer 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给定长度为N的数列A,以及M条指令 (N≤500000, M≤100000),每条指令可能是以下两种之一:“2 x y”,把 A[x] 改成 y。“1 x y”,查询区间 [x,y] 中的最大连续子段和,即 max(x≤l≤r≤y)⁡ { ∑(i=l~r) A[i] }。对于每个询问,输出 阅读全文
posted @ 2019-08-06 20:54 Snow_in_winer 阅读(202) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页