2013年3月27日

欧拉回路的一点研究与Codeforces 62D Wormhouse

摘要: 图G的一个回路,若它恰通过G中每条边一次,则称该回路为欧拉回路。具有欧拉回路的图称为欧拉图。欧拉回路就是从图上的一点出发,经过所有的边一次,最终回到起点的路径。首先是求出图中所有欧拉回路的朴素算法。深搜遍历所有的边,直到找到所有的欧拉回路。void dfs(int u,int deep) { ans[deep]=u;//将点u加入到路径中 if (deep==m)//若遍历了所有的边 { if (u==bg)//终点等于起点,即找到欧拉回路 { for (int i=0; i<=m; i++) ... 阅读全文

posted @ 2013-03-27 15:13 电子幼体 阅读(225) 评论(0) 推荐(0) 编辑

2013年3月23日

poj 3013 Big Christmas Tree 最短路

摘要: Big Christmas TreeTime Limit:3000MSMemory Limit:131072KTotal Submissions:18039Accepted:3811DescriptionChristmas is coming to KCM city. Suby the loyal civilian in KCM city is preparing a big neat Christmas tree. The simple structure of the tree is shown in right picture.The tree can be represented as 阅读全文

posted @ 2013-03-23 20:50 电子幼体 阅读(112) 评论(0) 推荐(0) 编辑

SPFA模板

摘要: #include <iostream> #include <cstdio> #include <cstring> #include <queue> using namespace std; const int maxn=155555; const int INF=-1; struct NODE { int to; long long w; int next; }link[maxn]; int edge,node,src,dest; long long dist[maxn]; int head[maxn]; bool visit[maxn]; in 阅读全文

posted @ 2013-03-23 20:35 电子幼体 阅读(118) 评论(0) 推荐(0) 编辑

2013年3月21日

强力开刷图论----目录(图论再临)

摘要: 第一章、图Codeforces 246D. Colorful GraphCodeforces 24A. Ring roadCodeforces 25D. Roads not only in Berland 并查集1.3 图的遍历Codeforces 278C. Learning Languages 图的遍历Codeforces 103B. Cthulhu 寻找奈亚子Codeforces 217A. Ice Skating 搜索Codeforces 263 D. Cycle in Graph 环Codeforces 107A. Dorm Water Supply 搜图Codeforces 117 阅读全文

posted @ 2013-03-21 15:50 电子幼体 阅读(226) 评论(0) 推荐(0) 编辑

[置顶] 强力开刷图论----目录(不定期更新)

摘要: 第一章、图Codeforces 246D. Colorful GraphCodeforces 24A. Ring roadCodeforces 25D. Roads not only in Berland 并查集1.3 图的遍历Codeforces 278C. Learning Languages 图的遍历Codeforces 103B. Cthulhu 寻找奈亚子Codeforces 217A. Ice Skating 搜索Codeforces 263 D. Cycle in Graph 环Codeforces 107A. Dorm Water Supply 搜图Codeforces 117 阅读全文

posted @ 2013-03-21 15:50 电子幼体 阅读(210) 评论(0) 推荐(0) 编辑

2013年3月17日

poj 1182 食物链 并查集

摘要: 食物链Time Limit:1000MSMemory Limit:10000KTotal Submissions:33327Accepted:9678Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。有人用两种说法对这N个动物所构成的食物链关系进行描述:第一种说法是"1 X Y",表示X和Y是同类。第二种说法是"2 X Y",表示X吃Y。此人对N个动物,用上述两种说法,一句接一句地说出K句话,这K句 阅读全文

posted @ 2013-03-17 17:34 电子幼体 阅读(175) 评论(0) 推荐(0) 编辑

hdu 1400 Mondriaan's Dream 状态压缩

摘要: Problem DescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, for all of his paper was filled with squares and rectangles), he dreamt of filling a 阅读全文

posted @ 2013-03-17 15:18 电子幼体 阅读(147) 评论(0) 推荐(0) 编辑

2013年3月8日

较为复杂的动态规划整理

摘要: 一、POJ 1191 棋盘分割化简均方差的公式后发现,均方差的平方=(1/n)*(n个矩形总分平方的和)-平均值的平方。f[k][x1][y1][x2][y2]表示将左上角坐标为(x1,y1)右下角坐标为(x2,y2)的矩形分割k次得到的总分平方和的最小值。s[x1][y1][x2][y2]表示矩形(x1,y1)(x2,y2)总分的平方。t1=min(f[k-1][x1][a][x2][y2]+s[x1][y1][x2][a-1], f[k-1][x1][y1][x2][a-1]+s[x1][a][x2][y2]);(y1+1<=a<=y2)//横向切割t2=min(f[k-1][ 阅读全文

posted @ 2013-03-08 18:21 电子幼体 阅读(124) 评论(0) 推荐(0) 编辑

2013年2月28日

hdu3535 分组背包的研究

摘要: AreYouBusyTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1833Accepted Submission(s): 701Problem DescriptionHappy New Term!As having become a junior, xiaoA recognizes that there is not much time for her to AC problems, because there are some other 阅读全文

posted @ 2013-02-28 18:11 电子幼体 阅读(148) 评论(0) 推荐(0) 编辑

2013年2月23日

WindowsAPI笔记(三)---绘制图形

摘要: 首先介绍一下GDI(GraphicsDeviceInterface)。GDI,中文翻译为“图形设备接口”,是WindowsAPI中相当重要的一个成员,它掌管了所有显像设备的图像显示及输出功能。Windows系统现在的图形操作环境都是他的功劳。Ⅰ.坐标与DC在实际利用GDI绘图之前,我们先来了解一下几个屏幕绘图的基本概论。▲创建一个窗口之后,显示的屏幕上便划分出三个区域,即屏幕区(Screen),窗口区(Window)与内部窗口区(Client)▲DeviceContext(设备内容)一般简称为DC,就绘图观点来说,DC就是程序可以进行绘图的地方。▲在处理WM_PAINT消息以外的地方,若要取得 阅读全文

posted @ 2013-02-23 16:54 电子幼体 阅读(850) 评论(0) 推荐(0) 编辑

导航