
代码发布
文章平均质量分 77
skyfisherman
这个作者很懒,什么都没留下…
展开
-
炮兵阵地
炮兵阵地 【DP+状态压缩】 program cannon; var n,m,tot,i,j,ans:longint;ch:char; sto:array[1..60]of longint; tor:array[1..60]of byte; a:array[0..100]of longint; f:array[0..100,0..60,0..60]of l原创 2011-11-10 19:22:01 · 576 阅读 · 0 评论 -
阿狸的打字机
70分 裸的AC自动机 program type2; type node=record son:array[0..25]of longint; fa,fail,key,e:longint; end; var a:array[1..100005]of node; sto:longint=1; st:array[1..100005]of char; len:longint; q,原创 2012-07-18 16:22:48 · 1061 阅读 · 0 评论 -
[中山市选] 杀人游戏
原题:中山市选 2011 杀人游戏 方法:Tarjan program kill_game; const maxn=100000; maxm=300000; type link=^node; node=record x:longint; next:link;end; procedure push(var x:link; const t:longint);var p:l原创 2012-07-20 09:21:11 · 2127 阅读 · 0 评论 -
[中山市选] 序列
直接上代码 program seq; const maxn=100000+10; var a,f,g,f1,f2:array[0..maxn]of int64; i,j,n:longint; ans:int64; function max(i,j:int64):int64; begin if i>j then exit(i); exit(j); end; func原创 2012-07-20 09:45:59 · 1642 阅读 · 0 评论 -
Code for fun (1)
矩阵乘法 (Size*Size) class mat{ const static int Size=10; unsigned long long a[Size][Size]; friend::mat operator*(const mat&a, const mat&b) { mat c; for(int i=0;i<Size;i++原创 2012-10-25 13:13:28 · 611 阅读 · 0 评论 -
[中山市选] 完全平方数
方法:欧拉筛法 莫比乌斯函数 program number; const maxt=50000; var isprime:array[1..maxt]of boolean; prime:array[1..maxt]of longint; minu:array[1..maxt]of shortint; total,test,n:longint;原创 2012-07-20 09:47:50 · 1760 阅读 · 0 评论 -
codeforces Round#158 Div.2 小结
Codeforces Round # 158 (Div.2) 这次练习我有很大的收获。首先简单的题目不能想复杂了,像第一题,n=8,这个条件被我无视了;其次简单的贪心题目出了点问题,以后思维要更严密;然后c++的stl库用起来真的很方便。总之花了一天的时间把这套题AC了。 A Adding Digits 题目大意:定义操作(a,b)::在a后面添加一个数字(10进制),并使新的数字能原创 2013-01-05 20:01:56 · 967 阅读 · 0 评论 -
SGU 代码集 (Volume 1)
SGU 100~119 一句话题解,代码 (更新中……) 100 A+B problem 101 Domio 构图,求一个欧拉路 # include # include # include # include using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define PNA {puts("No soluti原创 2013-06-12 20:40:47 · 810 阅读 · 0 评论 -
树链剖分系列
树链剖分 代码集 QTREE # include # include # include # include using namespace std; # define MAXN 10020 struct node{ int m, L, R; node *l, *r; node(int a,int b): L(a),R(b),l(NULL),r原创 2013-06-16 18:22:37 · 622 阅读 · 0 评论 -
NOI 兔兔与蛋蛋的游戏
二维的一个最大匹配 program game; type rec=record x,y:longint; end; const numm:rec=(x:0;y:0); dx:array[1..4]of integer=(0,1,0,-1); dy:array[1..4]of integer=(1,0,-1,0); var link:array[0..41,0..41]of re原创 2012-07-18 09:25:23 · 758 阅读 · 0 评论 -
NOI 项链工厂
原题:NOI 项链工厂 方法:线断树 program necklace; const maxn=500000; var ls,rs,s,cl,cr,z:array[1..maxn shl 2]of longint; sto,col,cur:longint; rev:boolean; procedure update(const x:longint); begin原创 2012-07-17 15:30:39 · 880 阅读 · 0 评论 -
块状树(count)
原题:ZJOI2008 count 方法:块状树 program count_trees;{$M 9999999} const maxn=30000+20; type link=^node; node=record x:longint; next:link; end; var own,w,dep,sum,size,fa,mun:array[0..maxn]of longint;原创 2012-07-10 10:57:21 · 1621 阅读 · 1 评论 -
SBT(pet)
原题:HNOI2004 宠物收养所 方法:SBT 维护 program size_balanced_tree;{$inline on} const maxn=80000; type point=^longint; var s,l,r,w:array[0..maxn] of longint; a,b:point; ans,m,t,k,now,root,sto:lo原创 2012-07-10 11:00:58 · 374 阅读 · 0 评论 -
Splay(sequence)
原题:NOI 2005 维护数列 方法:单旋SPLAY program sequences;{$inline on}{start at 6:42} const maxn=500005; var l,r,w,s,sum,max,lm,rm,c,ss:array[0..maxn]of longint; rev:array[0..maxn]of boolean; top,k:long原创 2012-07-10 11:02:24 · 456 阅读 · 0 评论 -
Link Cut Tree (paint)
原题:SDOI 2011 染色 方法:LCT维护 program paint; type link=^node; node=record x:longint; next:link; end; const maxn=100000; var q,f,l,r,c,lc,rc,rev,d:array[0..maxn]of longint; tp:array[0..max原创 2012-07-10 11:03:55 · 704 阅读 · 0 评论 -
Splay(dispatching)
原题:APIO 2012 派遣 方法:splay 启发式合并 program dispatching; const maxn=100000+100; type link=^node;node=record x:longint; next:link;end; var l,r,s,w,f,fa:array[1..maxn]of longint; ge:array[1..ma原创 2012-07-10 10:59:22 · 407 阅读 · 0 评论 -
搜索 MAYAN
原题:NOIP 2011 MAYAN 类型:搜索 (小剪枝),不是很难 program mayan; type byte=integer; state=array[1..5,1..7]of byte; oper=object a,b,c:array[1..5]of byte; procedure push(d,x,y,t:byte); procedure print;原创 2012-07-11 14:08:52 · 426 阅读 · 0 评论 -
《生成树计数》预处理
原题:NOI 生成树计数 { 预处理矩阵 } program predo;{start at 18:30} type state=array[1..6]of byte; var a:array[1..60]of state;c:state;n,i,j,tot:longint; mat:array[1..60,1..60]of longint;init:array[1..60]of lo原创 2012-07-16 20:22:42 · 434 阅读 · 0 评论 -
智能车比赛
(NOI2011 智能车比赛) program car; const inf=1e49; type node=record x,y:longint; end; operator -(a:node;b:node)c:node;begin c.x:=a.x-b.x; c.y:=a.y-b.y; end; operator *(a:node;b:node)c:double;begin c:原创 2012-07-15 19:23:04 · 779 阅读 · 0 评论 -
1D1D动态规划优化
原题:HNOI 玩具装箱 方法:1D1D (模板) program toy; const maxn=55000; var s,f:array[0..maxn]of int64; q:array[0..maxn]of record l,r,c:longint; end; n,len:longint; procedure init;var i:lo原创 2012-07-15 11:00:30 · 2181 阅读 · 0 评论 -
代码库 显示多项式
显示多项式 # include # include # include # include using namespace std; void output_poly(double a,int n,bool first) { if(fabs(a) < 1e-8) { if(first) cout << 0; return; } if (!first) {原创 2014-01-01 14:40:17 · 609 阅读 · 0 评论