![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
随记
gaokuilin1060083530
这个作者很懒,什么都没留下…
展开
-
lower_bound(),
函数lower_bound()在first和last中的前闭后开区间进行二分查找,返回大于或等于val的第一个元素位置。如果所有元素都小于val,则返回last的位置 举例如下: 一个数组number序列为:4,10,11,30,69,70,96,100.设要插入数字3,9,111.pos为要插入的位置的下标 则 pos = lower_bound( number, num转载 2014-08-23 09:36:31 · 413 阅读 · 0 评论 -
pointer to a function used in arithmetic
比如: #include void a(int x) { printf("test\n"); } int main(int argc, char const *argv[]) { a[0]; return 0; }原创 2014-10-15 16:10:24 · 4459 阅读 · 0 评论 -
sublime3 c++环境配置,可cmd输入,安装插件管理 Package Control,乱码
sublime3 c++环境配置: http://blog.csdn.net/lhshu2008/article/details/17582949 最后原创 2014-07-23 18:27:11 · 792 阅读 · 0 评论 -
sizeof()
sizeof(数组名):数组的实际大小 sizeof(z)原创 2014-10-05 15:40:50 · 283 阅读 · 0 评论 -
扩展欧几里得算法
一定存在ax+by=gcd(a,b)的解,为了求想,原创 2014-09-14 16:20:48 · 370 阅读 · 0 评论 -
随记
用异或jiao'h void exchange(int &a, int &b) { if(a == b) return; //防止&a,&b指向同一个地址;那样结果会错误。 a ^= b; b ^= a; a ^= b; }原创 2014-08-14 15:47:41 · 294 阅读 · 0 评论 -
floyed 理解
如果有一个矩阵D=[d(ij)],其中d(ij)>0表示i城市到j城市的距离。若i与j之间无路可通,那么d(ij)就是无穷大。又有d(ii)=0。编写一个程序,通过这个距离矩阵D,把任意两个城市之间的最短与其行径的路径找出来。 我们可以将问题分解,先找出最短的距离,然后在考虑如何找出对应的行进路线。如何找出最短路径呢,这里还是用到动态规划的知识,对于任何一个城市而言,i到j的最短距离不转载 2014-08-18 16:39:06 · 457 阅读 · 0 评论 -
lis nlogn
lis的nlogn算法 lis有一般的O(N^2)的dp算法:d[i]=max{0,d[j]|j 比如1,3,2,4。d[4]=max{0,d[1],d[3],d[2]}+1(如果lis可以有相同的值,取 然而有些情况可能O(N^2)的dp算法速度不符合要求,便有了下面的nlogn算法。 首先给出代码,然后解释为什么: for(int i=1; i for(int i=0; i {原创 2014-08-23 11:41:57 · 513 阅读 · 0 评论 -
unix回射服务器,客服端
客服端 #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define PORT 7000 #define EXIT_ERR(m) \ do{\ perror(m);\ printf("\n");\ exi原创 2015-07-18 15:28:26 · 349 阅读 · 0 评论