会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
ljlin
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
···
8
下一页
2014年3月22日
使用priority_queue实现Dijkstra
摘要: 主要是记得传比较算子进去,优先队列要的那个算子参数大概是用来定义优先级的,默认是less,大概是优先级低的先出队。想要从小到大排序要传greater进去。 1 priority_queue,greater > Q; 2 Q.push(make_pair(0,1));dis[1]=0;...
阅读全文
posted @ 2014-03-22 00:08 ljlin
阅读(706)
评论(0)
推荐(0)
2014年2月18日
关于const的一个有趣的现象
摘要: 先上代码#include using namespace std;int main(){ // vector::iterator it=const_cast::iterator >(v.begin()); // vector::iterator it=(v.begin()); const int a=0; int &b=const_cast(a); //int &b=(int &)a;这个也可以 b=10; cout(&c); // int *d=(int *)&c; *d=10; cout<<c<<','&
阅读全文
posted @ 2014-02-18 23:07 ljlin
阅读(304)
评论(1)
推荐(0)
2014年2月14日
用splay来维护序列
摘要: 大白书例题 uva11922留个splay模板虚拟节点可以是放个最小的也可以放最大的,两种方法对同一个点会导致名次相差一。弄一个节点当null确实比较方便一开始序列转化成树居然可以直接搞出一条链也没问题,这个略屌。#include #include using namespace std;struc...
阅读全文
posted @ 2014-02-14 14:18 ljlin
阅读(685)
评论(0)
推荐(0)
2013年12月30日
关于指针的一个小程序
摘要: 定义一个指针,使得其指向一个一维数组的空间,并且能被当做三维数组名用。 当时暑假问的tbc Code#includeusing namespace std;int a[1000];int main(){ int (*p)[10][10]=(int(*)[10][10])&a[0]; cout>i>>j>>k) cout<<p[i][j][k]<<endl; return...
阅读全文
posted @ 2013-12-30 20:32 ljlin
阅读(199)
评论(0)
推荐(0)
2013年12月2日
Treap实现的名次树
摘要: 1.感觉之前邵叔叔教的做fib的那个支持删除(其实删除只是打标记,而且不支持插入。。。)和查询的排序二叉树就是个静态的名次树嘛。我居然学到了这么奇怪的数据结构。。。2.写的时候坑了几次 (1)不要乱用引用,getKth里那个参数o没过脑子用了引用,结果把树搞烂了,一堆ch[x]赋值成NULL了。 (2)写查找的时候lchsize#include #include #include using namespace std;struct Node { Node *ch[2]; int r,v,s; Node(int v):v(v) ...
阅读全文
posted @ 2013-12-02 21:14 ljlin
阅读(1078)
评论(0)
推荐(0)
2013年11月30日
stl学习笔记—set/multimap
摘要: 下面搜到的set的一些说明在这里搜到的 http://blog.csdn.net/xuruoxin/article/details/12654093 Code set的基本操作:begin() 返回指向第一个元素的迭代器clear() 清除所有元素count() 返回某个值元素的个数empty() 如果集合为空,返回trueen...
阅读全文
posted @ 2013-11-30 17:26 ljlin
阅读(206)
评论(0)
推荐(0)
2013年11月28日
2013 杭州站 hdoj4778 Gems Fight!
摘要: 没过,不想写了。。。唉。。。网上找了了代码对拍都拍不出错数据。。。。这泥煤。。。。。。。。。 有大神能帮忙看出来哪里错了就太感谢了。。。。 Code#include #include #include using namespace std;const int MAXB=21+10,MAXG=8+10;int c[MAXB][MAXG],res[(1>G>>B>>S){ if((...
阅读全文
posted @ 2013-11-28 21:25 ljlin
阅读(173)
评论(0)
推荐(0)
矩阵加速数列递推
摘要: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4973ZOJ Problem Set - 3690Code#include #include using namespace std;struct Matrix{ #define ...
阅读全文
posted @ 2013-11-28 21:19 ljlin
阅读(215)
评论(0)
推荐(0)
暑假写的两个数据结构
摘要: 最近翻了一下暑假的代码,发现了点有用的东西。 斜堆 记得是个猴子打架的题目 Code#include #include #include using namespace std;const int N=100000;int f[N+10],head[N+10],lch[N+10],rch[N+10],w[N+10];int merge(int A,int B) { if(A=...
阅读全文
posted @ 2013-11-28 21:15 ljlin
阅读(197)
评论(0)
推荐(0)
AC自动机模板 hdoj2222 UVA-11468
摘要: 多模式串匹配,在给出的字符串中查找出现了几个模板串。允许模板串重复,某一个模板串是另一个的前缀或后缀。http://acm.hdu.edu.cn/showproblem.php?pid=2222#include #include #include #define maxnode 550000...
阅读全文
posted @ 2013-11-28 21:08 ljlin
阅读(240)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
···
8
下一页
公告