且未

博客园 首页 新随笔 联系 订阅 管理
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 24 下一页

2018年8月2日 #

摘要: Bellman-ford:/*bellman ford*/#include #include #include using namespace std;const int INF = 0x3f3f3f3f;const int Max = 9999;typedef st... 阅读全文
posted @ 2018-08-02 10:57 阿聊 阅读(88) 评论(0) 推荐(0)

摘要: 题目spfa: #include using namespace std;const int maxn = 205;const int INF = 0x3f3f3f3f;vector > E[maxn];int n,m;int d[maxn],inq[maxn];/... 阅读全文
posted @ 2018-08-02 10:51 阿聊 阅读(97) 评论(0) 推荐(0)

2018年7月31日 #

摘要: 首先 什么是01背包问题?(可以参考下百度百科 只是我觉得百度百科对于为什么逆序这个问题解释的不是特别清楚)(以下题目中的内容摘自百度百科)////////////////////////////////////////////////////////////////... 阅读全文
posted @ 2018-07-31 20:39 阿聊 阅读(1460) 评论(1) 推荐(3)

摘要: 首先引进一个符号:gcd是greatest common divisor(最大公约数)的缩写,gcd( x,y ) 表示x和y的最大公约数。然后有一个事实需要了解:一个奇数的所有约数都是奇数。这个很容易,下面我们要用到。 来研究一下最大公约数的性质,我们发现有... 阅读全文
posted @ 2018-07-31 16:33 阿聊 阅读(1156) 评论(0) 推荐(1)

摘要: 题目A/9973=n那么:n= A - A / 9973 * 9973 ……①设:A/B=x 则A=B*x,代入① 得 n=B*x-A/9973*9973然后这个方程中的A/9973不要去纠结它,A就当不知道,然后,方程可变成二元方程 B * x - 997... 阅读全文
posted @ 2018-07-31 15:15 阿聊 阅读(113) 评论(0) 推荐(0)

2018年7月27日 #

摘要: //修改区间,查询点#include#includeusing namespace std;const int maxn=100005;const int maxq=100005;int a[maxn];int b[maxn];int c[maxn];//a原数组,... 阅读全文
posted @ 2018-07-27 20:55 阿聊 阅读(295) 评论(0) 推荐(0)

摘要: 今天学习了一下差分数组,觉得好神奇啊。1.定义:对于已知有n个元素的离线数列d,我们可以建立记录它每项与前一项差值的差分数组f:显然,f[1]=d[1]-0=d[1];对于整数i∈[2,n],我们让f[i]=d[i]-d[i-1]。2.简单性质:(1)计算数列各项的值... 阅读全文
posted @ 2018-07-27 17:34 阿聊 阅读(206) 评论(0) 推荐(0)

摘要: int Lowbit(int x){ return x&(-x);}lowbit当中x,-x,补码,反码,傻傻分不清楚。我们先看看两个二进制数相减的问题两个二进制数相减的相关问题两个二进制数相减的时候可以把符号括起来转化为加法,比如010-111,这时候就可以写... 阅读全文
posted @ 2018-07-27 09:59 阿聊 阅读(178) 评论(0) 推荐(0)

2018年7月26日 #

摘要: 题目两个操作: 1. Add x y value: Add value to the element Axy. (Subscripts starts from 02. Sum x1 y1 x2 y2: Return the sum of every element A... 阅读全文
posted @ 2018-07-26 21:00 阿聊 阅读(122) 评论(0) 推荐(0)

摘要: mod与%的区别 %与mod的区别:%出来的数有正有负,符号取决于左操作数,而mod只能是正;所以要用%来计算mod的话就要用这样的公式:a mod b = (a % b + b) % b;括号中的式子可以把左操作数转变为正数。 阅读全文
posted @ 2018-07-26 20:56 阿聊 阅读(1903) 评论(0) 推荐(0)

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 24 下一页