会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
liangh
博客园
首页
新随笔
联系
管理
订阅
2014年8月8日
poj3667 hotel
摘要: 第一次写区间合并的题目,实在有点棘手,就顺着TK学长的思路敲了一编代码,但还是磕磕绊绊的,继续敲一道区间合并的题吧#include #define size 500010#define Lson (xb?a:b;}void buildtree(int rt,int L,int R){ flag...
阅读全文
posted @ 2014-08-08 16:23 TK在颤抖
阅读(256)
评论(0)
推荐(0)
2014年8月7日
hdu1754
摘要: 各种错误都尝试过了,最终是没有考虑多组数据#include#include#include#include#include#define size 600100using namespace std;int sum[size],ret =0;void buildtree(int rt,int L,i...
阅读全文
posted @ 2014-08-07 12:11 TK在颤抖
阅读(126)
评论(0)
推荐(0)
2014年8月5日
hdu2222
摘要: 数组开小了,还是小了很多,注意数组里的是节点总数!#include#include#include#include#include#define maxn 500000+10using namespace std;int ch[maxn][26],fail[maxn],last[maxn],val[...
阅读全文
posted @ 2014-08-05 14:31 TK在颤抖
阅读(589)
评论(0)
推荐(0)
2014年8月4日
poj2503
摘要: 字典树的应用题目,虽然照模板就能打出来,但是看着学长的代码,学会了sscanf的用法,sscanf(str,"%s%s",a,b)把str分成a和b两个字符串,分隔符为空格#include#include#include#include#includeusing namespace std;int ...
阅读全文
posted @ 2014-08-04 15:24 TK在颤抖
阅读(220)
评论(0)
推荐(0)
2014年8月1日
hdu1166
摘要: 没有用到懒惰标记的线段树问题,不过通过这道题找到了不用数组就能找到写update的方法了#include#include#include#include#includeusing namespace std;#define max 50010#define INF 0x3f3f3f3fint tre...
阅读全文
posted @ 2014-08-01 16:05 TK在颤抖
阅读(420)
评论(0)
推荐(0)
2014年7月30日
csuoj 1256
摘要: 题意:给出一张有向图,问最少改变多少条边的方向,使得图中存在一条从1到N的路径思路:原本有的路径权值为0,新加一个反向的路径,权值为1,这样只要走一次新加的路径,最短路就会加1,最后的长度就是新加路径的个数了 #include#include#include#includeusing namesp...
阅读全文
posted @ 2014-07-30 10:23 TK在颤抖
阅读(408)
评论(0)
推荐(0)
2014年7月29日
1874畅通工程续(dijkstra算法)
摘要: 迷糊了好长时间,一开始有好多不理解的,到现在还没完全理清,不过比上午好多了,感觉不错,#include#include#include#includeusing namespace std;int n,m;const int maxn = 210;const int maxm = 2010;cons...
阅读全文
posted @ 2014-07-29 17:27 TK在颤抖
阅读(168)
评论(1)
推荐(0)
hdu1874畅通工程再续
摘要: 抠了一天的最短路问题,那个spfa还真是难写,只能照着模板打一遍,还有那个松弛操作有点明白怎么回事,但还是不太清晰,容我再抠抠,然后再用dijksta算法敲一遍这道题吧!#include#include#include#includeint n,m;const int inf = 0x3f3f3f3...
阅读全文
posted @ 2014-07-29 15:24 TK在颤抖
阅读(136)
评论(0)
推荐(0)
2014年7月28日
FZU 1901
摘要: 运用KMP算法解决的一道题,求一下Next数组,然后直接找最后一个元素的next值,依次找下标为next的元素,直接用总数减去next值就是要求的一个数,直到找到next的值为0的时候结束!#include#include#includeusing namespace std;int a[10000...
阅读全文
posted @ 2014-07-28 13:20 TK在颤抖
阅读(196)
评论(0)
推荐(0)
2014年7月27日
CodeForces 451A
摘要: 签到题,今天就水了这么一道题,不好意思说了。。。#includeusing namespace std;int main(){ int a,b; cin >> a>> b; int c = a<b?a:b; if(c%2 == 0) cout<< "Malvika"<<...
阅读全文
posted @ 2014-07-27 15:42 TK在颤抖
阅读(108)
评论(0)
推荐(0)
下一页
公告