自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(42)
  • 收藏
  • 关注

原创 二分图匹配总结

1.一个二分图中的最大匹配数等于这个图中的最小点覆盖数König定理是一个二分图中很重要的定理,它的意思是,一个二分图中的最大匹配数等于这个图中的最小点覆盖数。如果你还不知道什么是最小点覆盖,我也在这里说一下:假如选了一个点就相当于覆盖了以它为端点的所有边,你需要选择最少的点来覆盖所有的边。2。最小路径覆盖=最小路径覆盖=|G|-最大匹配数 在一个N*N的有向图中,路径覆盖就是在图

2015-04-02 23:04:58 655

原创 CODE[VS] 1036 商务旅行(LCA + BFS)

题目描述 Description某首都城市的商人要经常到各城镇去做生意,他们按自己的路线去做,目的是为了更好的节约时间。假设有N个城镇,首都编号为1,商人从首都出发,其他各城镇之间都有道路连接,任意两个城镇之间如果有直连道路,在他们之间行驶需要花费单位时间。该国公路网络发达,从首都出发能到达任意一个城镇,并且公路网络不会存在环。你的任务是帮助该商人计算一下他的最短旅行时间。

2015-04-29 16:48:49 1163

原创 高精度模版

还算可以的模版#include #include #include #include #include #define ll long long#define MAXN 9999#define MAXSIZE 10#define DLEN 4using namespace std;class BigNum{private: int a[500]; //可以控制大

2015-04-28 23:31:14 519

原创 犯罪团伙(并查集)

题目描述 Description1920年的芝加哥,出现了一群强盗。如果两个强盗遇上了,那么他们要么是朋友,要么是敌人。而且有一点是肯定的,就是:我朋友的朋友是我的朋友;我敌人的敌人也是我的朋友。 两个强盗是同一团伙的条件是当且仅当他们是朋友。现在给你一些关于强盗们的信息,问你最多有多少个强盗团伙。输入描述 Input Description 输入文

2015-04-27 21:38:04 1201

原创 HDU 2089 不要62(数位DP)

题意:求n 到 m 的区间范围内不含有4 和 62 的数字个数。 解题思路 与 HDU 3555类似#include #include #include #include #include #include #include #include #include #include using namespace std;const int MAXN = 10;int

2015-04-27 20:55:39 801

原创 HDU 3555 Bomb(数位DP)

题意:寻找0  到 n 中含有49的数字的个数#include #include #include #include #include #include #include #include #include using namespace std;const int MAXN = 50 + 10;long long dp[MAXN][3];// dp[i][0] 长

2015-04-27 20:07:19 588

原创 HDU 1428 漫步校园(bfs + 记忆化搜索)

Problem Description:LL最近沉迷于AC不能自拔,每天寝室、机房两点一线。由于长时间坐在电脑边,缺乏运动。他决定充分利用每次从寝室到机房的时间,在校园里散散步。整个HDU校园呈方形布局,可划分为n*n个小方格,代表各个区域。例如LL居住的18号宿舍位于校园的西北角,即方格(1,1)代表的地方,而机房所在的第三实验楼处于东南端的(n,n)。因有多条路线可以选择,LL希望每次的散

2015-04-23 17:45:58 860

原创 HDU 3974 Assign the task(线段树)

#include #include #include #include #include #include #include #include #include #include #define ll long longusing namespace std;const int MAXN = 50000 + 10;struct Edge{ int to, nex

2015-04-22 23:03:38 609

原创 POJ 2481 Cows

解题思路:实质是排序后求逆序对#include #include #include #include #include #include #include #include #include #include #include #define ll long longusing namespace std;const int MAXN = 100000 + 10;

2015-04-22 15:56:34 736

原创 ZOJ 3795 Grouping(强联通分量 + 缩点 + Dp)

Problem Description:Suppose there are N people in ZJU, whose ages are unknown. We have some messages about them. Thei-th message shows that the age of person si is not smaller than the age of pers

2015-04-19 22:52:25 599

原创 ZOJ 3865 Superbot

解题思路:简单的bfs, 记录一下当前的键盘状态。#include #include #include #include #include #include #include #include #include #include #define ll long longusing namespace std;int Move[][2] = { {0, -1}, {0

2015-04-18 22:37:49 467

原创 ZOJ Conquer a New Region(并查集)

The wheel of the history rolling forward, our king conquered a new region in a distant continent.There are N towns (numbered from 1 to N) in this region connected by several roads. It's confirme

2015-04-17 23:19:29 634

原创 ZOJ GCD Expectation

#include #include #include #include #include #include #include #include #include #define LL long longusing namespace std;const int MAXN = 1000000 + 10;const int MOD = 998244353;LL pow_mod

2015-04-17 19:17:50 827

原创 HDU 5194 DZY Loves Balls(概率)

Problem Description:There are n black balls and m white balls in the big box.Now, DZY starts to randomly pick out the balls one by one. It forms a sequence S. If at the i-th operation,

2015-04-15 23:20:24 848

原创 HDU 3635 Dragon Balls(并查集)

#include #include #include #include #include #include #include #include #include #include #include using namespace std;const int MAXN = 10000 + 10;int f[MAXN];int Move[MAXN];int num[MAX

2015-04-15 17:21:05 428

原创 HDU 5202 Rikka with string

Problem Description:As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:One day, Yuta got a string which

2015-04-15 16:13:45 384

原创 SGU 495 Kids and prizes(概率题,二项分布)

495. Kids and PrizesTime limit per test: 0.25 second(s)Memory limit: 262144 kilobytesinput: standardoutput: standardICPC (International Cardboard Producing Company) is in the busines

2015-04-14 17:36:01 510

原创 HDU 4586 Play the dice(概率题,推公式)

Problem Description:There is a dice with n sides, which are numbered from 1,2,...,n and have the equal possibility to show up when one rolls a dice. Each side has an integer ai on it. Now here is a

2015-04-14 16:23:41 800

原创 SGU 105 div3

105. Div 3time limit per test: 0.25 sec. memory limit per test: 4096 KBThere is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. You must determine a

2015-04-12 11:08:16 674

原创 HDU 2354 Another Brick in the Wall(优先队列,bfs)

Problem Description:After years as a brick-layer, you've been called upon to analyze the structural integrity of various brick walls built by the Tetrad Corporation. Insteadof using regular-sized

2015-04-10 23:47:44 1225

原创 HDU 4664 Triangulation (SG函数,打表找规律)

解题思路:打表,发现是一个带尾巴的循环,找循环节,34;#include #include #include #include #include #include #include #include using namespace std;const int MAXN = 1000 + 10;int vis[MAXN];int SG[MAXN];int mex(in

2015-04-10 14:53:30 641

原创 HDU 3032 Nim or not Nim(SG函数打表找规律)

解题思路:通过打表发现,当x % 4 == 0 的时候SG值为x - 1,当x % 4 == 3的时候SG值为x + 1,其他时候SG值为x;//AC代码#include #include #include #include #include #include #include #include using namespace std;const int MAXN =

2015-04-10 14:16:12 538

原创 HDU 1524 A Chess Game(SG函数)

Problem Description:Let's design a new chess game. There are N positions to hold M chesses in this game. Multiple chesses can be located in the same position. The positions are constituted as a topo

2015-04-09 18:16:45 594

原创 HDU 4642 Fliping game(简单博弈)

解题思路:博弈问题不会出现平局,若右下角为0,先手永远也不可能赢。所以右下角为0先手输,右下角为1后手输#include #include #include #include using namespace std;const int MAXN = 100 + 10;int N, M;int m[MAXN][MAXN];int main(){ int T; scanf

2015-04-08 22:44:02 513

原创 HDU 4764 Stone(巴什博弈变形)

Problem Description:Tang and Jiang are good friends. To decide whose treat it is for dinner, they are playing a game. Specifically, Tang and Jiang will alternatively write numbers (integers) on a wh

2015-04-08 17:09:20 594

原创 HDU 3980 Paint Chain(SG函数)

Problem Description:Aekdycoin and abcdxyzk are playing a game. They get a circle chain with some beads. Initially none of the beads is painted. They take turns to paint the chain. In Each turn one p

2015-04-08 16:35:02 646

原创 HDU 1269 迷宫城堡 (强联通分量,Tarjan算法)

Problem Description:为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(NInput:输入包含多组数据,输入的第一行有两个数:N和M,接下来的M行每行有两个数a和b,表示了一条通道可以从A房间来到B房间。文件最后以两个0结束。Output:对于输入的每组数据,如果任意两个房间都是相互连接的,输出"Yes",否则输出"No"。S

2015-04-08 15:44:32 619

原创 奇偶性剪枝

奇偶剪枝是数据结构的搜索中,剪枝的一种特殊小技巧。现假设起点为(sx,sy),终点为(ex,ey),给定t步恰好走到终点,s    |    |    |    +———e

2015-04-08 15:33:29 876

原创 HDU 1010 Tempter of the Bone(dfs + 奇偶性剪枝)

#include #include #include #include #include #include #include #include #include #include #define LL long longusing namespace std;const int MAXN = 10;char s[MAXN][MAXN];int N, M, T;int

2015-04-07 23:58:28 372

原创 POJ 2176 Folding

C#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;const int MAXN = 100 + 10;const int INF = 0x3f3

2015-04-07 22:25:26 882

原创 POJ 2069 Super Star(模拟退火,最小球覆盖)

解题思路:给出空间内的n个点,找出覆盖这n个点的最小球的半径。用模拟退火来做。#include #include #include #include #include #include #include #include #include #include #define LL long longusing namespace std;const int MAXN

2015-04-07 15:58:02 1535

原创 HDU 1175 连连看(bfs + 剪枝)

Problem Description:“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能

2015-04-07 15:50:54 727

原创 ZOJ 1047 Image Perimeters (dfs)

解题思路:要求目标范围的周长,将图的外围全部置成 ‘.',那么水平方向搜索是遇到的点的数目之和便是所要求的周长。#include #include #include #include #include #include #include #include #include #include #define LL long longusing namespace std

2015-04-07 11:43:39 581

原创 ZOJ 1008 Gnome Tetravex

#include #include #include #include #include #include #include #include #include #include #define LL long longusing namespace std;const int MAXN = 100 + 10;int table[30];int squre[30][5]

2015-04-06 14:51:56 414

原创 ZOJ 1002 Fire Net(基础dfs)

#include #include #include #include #include #include #include #include #define LL long longusing namespace std;const int MAXN = 100 + 10;char m[MAXN][MAXN];int n, ans;bool canput(int x,

2015-04-06 13:48:29 477

原创 Linux下C语言操作数据库

MySQL是Linux系统下广泛使用的开源免费数据库,是Linux应用程序数据存储的首选。在Ubuntu系统下安装MySQL,可以在终端提示符中运行下列命令:$sudo apt-get install mysql-server mysql-client一旦安装完成,MySQL服务器应该自动启动,默认的MySQL安装后用户为root,安装过程中会提示你enter password,这个密

2015-04-03 14:14:07 810

原创 ZOJ 3460 Missile(二分+ 二分图匹配)

解题思路:把每一个可发射导弹的时间看成一个发射装置,总共n * m个,然后二分答案#include #include #include #include #include #include #include #include #include #include #include #include #define LL long long#define FOR(i, x

2015-04-03 11:55:00 477

原创 HDU 2389 Rain on your Parade(H-C算法,二分图匹配)

解题思路:比较适合大数据的二分图匹配,用匈牙利算法会超时#include #include #include #include #include using namespace std;const int MAXN = 3000 + 10;const int INF=1<<28;/***********************************************

2015-04-02 23:35:46 449

原创 HDU 4619 Warm up 2(点独立集)

#include #include #include #include #include #include #include #include #include #define LL long long#define FOR(i, x, y) for(int i=x;i<=y;i++)using namespace std;const int MAXN = 2000 + 1

2015-04-02 19:11:56 390

原创 HDU 2255 奔小康,赚大钱(KM算法模版)

解题思路:二分图带权匹配,卡费用流,用KM算法。#include #include #include #include using namespace std;/* KM算法 * 复杂度O(nx*nx*ny) * 求最大权匹配 * 若求最小权匹配,可将权值取相反数,结果取相反数 * 点的编号从0开始 */const int MAXN = 310;co

2015-04-02 12:06:10 776

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除