自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

mfcheer

已搬家至:www.mfcheer.com

  • 博客(40)
  • 资源 (1)
  • 收藏
  • 关注

原创 poj-1847

题目链接:http://poj.org/problem?id=1847把第一个相连的边设为0,其余的设为1.#include #include #include #include #include using namespace std;const int INF = 1000000;const int MAX = 110;int n,a,b;int m,f,t;

2015-01-30 15:46:22 693

原创 atof 函数说明

/*函数名: atof功 能: 把字符串转换成浮点数名字来源:ascii to floating point numbers 的缩写用 法: double atof(const char *nptr);atof(将字串转换成浮点型数)表头文件 #include 定义函数 double atof(const char *nptr);函数说明 atof()会扫描参数nptr字符串,

2015-01-29 20:29:40 1061

原创 poj-1502 MPI Maelstrom

题目链接:http://poj.org/problem?id=1502裸的最短路径。英语。。。#include #include #include #include #include using namespace std;#define MAXV 110#define INF 100000int map[MAXV][MAXV],n;int d[MAXV],vis[

2015-01-29 20:25:32 468

原创 poj-3259 Wormholes

题目链接:http://poj.org/problem?id=3259求是否存在负权环。用 bellman 判断。有一些农场,这些农场里面有一些田地,田地里面有一些虫洞,田地之间有路,虫洞可以让时间倒流。问这个农民能不能看到他自己,也就是说,有没有可能利用虫洞的时间倒流的性质,让这个人能在这个点出发前回去,这样他就是能看到他自己#include #include #

2015-01-29 19:20:52 455

原创 poj-3660 Cow Contest

题目链接:http://poj.org/problem?id=3660利用floyd进行闭包的传递确定胜负关系。这样所有点a能走到的点都是排名在a以后的。所有能走到点a的点都是排名在a以前的。如a点,排名在它之前的和排名在它之后的点之和为n-1,那么它的排名就是确定的。#include #include #include #include #include using

2015-01-29 11:16:55 608

原创 poj-3286 Silver Cow Party

题目链接:http://poj.org/problem?id=3268求牛参加聚会的往返最长的路径是多少。往返的时候翻转矩阵,再计算一次,两次求和。#include #include #include #include #include using namespace std;const int MAXV = 4010;const int inf = 10000000;

2015-01-29 10:26:53 606

原创 poj-3628 Silver Cow Party

题目链接:http://poj.org/problem?id=3268所有的牛去一个牛的家里参加聚会,所给的路径是单向的,问往返的所有牛的路径长度中最长的是多少?解法:往返时候翻转矩阵,再求一遍最短路径,两次相加后进行比较。#include #include #include #include #include using namespace std;const

2015-01-28 22:57:27 580

原创 poj-1797 Heavy Transportation

题目链接:http://poj.org/problem?id=1797求路径中承载量的最小值#include #include #include #include #include using namespace std;const int MAXV = 4010;const int inf = 10000000;int map[MAXV][MAXV];int d[

2015-01-28 16:59:04 648

原创 图论——最短路径——floyd

floyd 模板#include#include#include#include#include#include#include#include#include#include#include#include#include #include #include using namespace std;int d[1110][1110];int main

2015-01-28 14:56:12 465

原创 poj-2253 Frogger

题目链接:http://poj.org/problem?id=2253求最短路径中的最长边,修改的 d [MAXN]; 的意义即可

2015-01-28 14:52:18 622

原创 图论——最短路径——dij

dij 模板通过 poj 2387 求去点1 -点 n 的最短路径#include #include #include #include #include using namespace std;const int MAXV = 4010;const int inf = 10000000;int map[MAXV][MAXV];//路径长度int d[MAXV];/

2015-01-28 13:07:08 852

原创 poj-2387 Til the Cows Come Home

题目链接:http://poj.org/problem?id=2387dij 注意判重边#include #include #include #include #include using namespace std;const int MAXV = 4010;const int inf = 10000000;int map[MAXV][MAXV];int

2015-01-28 13:04:00 592

原创 poj-1789 Truck History

http://poj.org/problem?id=1789题意理解就是裸的MST#include#include#include#define INF 0x3f3f3f3fusing namespace std;char str[2010][10];int dis[2010],edge[2010][2010];bool vis[2010];int m,ans;in

2015-01-27 19:48:59 500

原创 poj-1751 Highways

http://poj.org/problem?id=1751最小生成树简单应用#include #include #include #include #include #include #include using namespace std;#define INF 10000000double map[1110][1110],dis[1110];int n,m,v

2015-01-27 16:50:45 663

原创 zoj -1586 QS Network

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1586简单题Sunny Cup 2003 - Preliminary RoundApril 20th, 12:00 - 17:00Problem E: QS NetworkIn the planet w-503 of galaxy cgb, t

2015-01-27 15:05:33 558

原创 poj-2031 Building a Space Statio

题目链接:点击打开链接又是一发  G++ WA , C++ AC.简单题:给出基站的三围坐标及半径 。若球面距离小于 0 距离为 0 ,否则为 圆心距离减去2个半径#include #include #include #include #include #define INF 10000000using namespace std;double map[110]

2015-01-27 14:53:44 587

原创 poj-1258 Agri-Net

http://poj.org/problem?id=1258简单题#include #include #include #include #include #define INF 10099990using namespace std;int map[110][110],dis[110],v[110];long long prim(int n){ int

2015-01-27 14:04:36 560

原创 poj-1679 The Unique MST

http://poj.org/problem?id=1679The Unique MSTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 21550 Accepted: 7619DescriptionGiven a connected

2015-01-27 13:36:37 774

原创 图论——次小生成树

次小生成树模板通过poj 1679#include #include #include #include #include #include #include #include using namespace std;#define INF 10000000/* * 次小生成树 * 求最小生成树时,用数组Max[i][j]来表示MST中i到j最大边权

2015-01-27 13:34:41 699

原创 hdu 1102 & poj 2421 Constructing Roads

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1102Constructing RoadsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14983    Accepted

2015-01-25 17:35:42 554

原创 poj-1251 Jungle Roads

题目链接:http://poj.org/problem?id=1251简单题#include #include #include #include #include #include #include using namespace std;#define INF 10000000int n, m;char a[5], b[5];int c, d;int ma

2015-01-25 14:32:23 737

原创 图论——最小生成树

通过:poj-1287#include #include #include #include #include #include #include using namespace std;#define INF 10000000int n, m;int a, b, c;int map[100][100], dis[100], v[100];int prim(in

2015-01-25 13:34:49 702

原创 poj-1287 最小生成树

简单题.NetworkingTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6448 Accepted: 3500DescriptionYou are assigned to design network connections b

2015-01-25 13:26:18 854

原创 hdu-3038 带权并查集

http://acm.hdu.edu.cn/showproblem.php?pid=3038题意:Ai,Bi,Si 表示 Ai Bi 之间数的和是Si问与前面命题冲突的命题有几个。val [ i ]  表示  i 与 fa[ i ]  相差多大 。How Many Answers Are WrongProblem Descriptio

2015-01-24 20:53:22 550

原创 图论——并查集

/* 并查集模板 by:mfcheer*/#include #include #include #include #include #include #include #include #include using namespace std;#define N 100010int n, m;int fa[N];int

2015-01-24 18:30:44 786

原创 hdu-1325 & poj-1308 Is It A Tree?

http://acm.hdu.edu.cn/showproblem.php?pid=1325题意:判断一个图是不是说树 只有树的根入度为 0 ,其余结点入度均为 1;Is It A Tree?Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total

2015-01-24 16:47:37 868

原创 Never Say Never

See I never thought that I could walk through fireI never thought that I could take the burnI never had the strength to take it higherUntil I reached the point of no returnAnd there's just no turning backWhen your hearts under attackGonna give everyt

2015-01-24 12:39:49 970

原创 hdu-4027 Can you answer these queries?

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4027修改操作是把区间内的所有数开根号区间求和操作2  的 63 次开方6,7 根号也就变为了 1 。#include #include #include #include #include #include #include #include #incl

2015-01-23 21:28:54 603

原创 poj-3264

http://poj.org/problem?id=3264基础线段树求区间最大值与最小值的差//poj 3264#include #include #include #include #include #include using namespace std;#define ll(ind) (ind<<1)#define rr(ind) (ind<<1|1)

2015-01-22 23:08:17 739

原创 poj-3468 区间操作

http://poj.org/problem?id=3468区间求和操作 ,一个区间加操作。#include #include #include #include #include #include #include #include #include #include using namespace std;#define ll(ind) (ind<<1)#d

2015-01-21 11:49:18 715

原创 hdu-1698

http://acm.hdu.edu.cn/showproblem.php?pid=1698实现求全部区间的和 ,修改部分区间的值。成段更新需要用到懒惰标记 lazy。简单来说就是每次更新的时候不要更新到底,用延迟标记使得更新延迟到下次需要更新or询问到的时候。延迟标记的意思是:这个区间的左右儿子都需要被更新,但是当前区间已经更新了。#include #inc

2015-01-20 18:21:48 762

原创 poj-1182 种类并查集

转:用0  1   2 分别表示A B C的关系。0吃1,1吃2,2吃0.注意这个编号都是以根结点为参照的,不是绝对的。开一个val数组,一开始这个数组为0,所有的点都是独立的,不是相连的,没有关系。慢慢加入点之后,把有关系的合并在一起,并且编号的相对大小确定一个集合中的关系。#include #include #include

2015-01-19 16:14:23 693

原创 hdu-1829 & poj-2492 并查集

http://acm.hdu.edu.cn/showproblem.php?pid=1829#include #include #include #include #include #include #include #include #include #include using namespace std;int t, n, m;int fa[2200]

2015-01-19 11:00:36 761

原创 poj-1611 并查集

http://poj.org/problem?id=1611简单并查集,建设学号是0 的学生已经是感染者,问与他同集合的人有多少个。#include #include #include #include #include #include #include #include #include #include using namespace std;

2015-01-18 14:54:24 632

原创 fork之后子进程与父进程关系

#include#include#include#includevoid main(){ char str[6]="hello"; pid_t pid=fork(); if(pid==0) { str[0]='b'; printf("子进程中str=%s\n",str); printf("子进程中str指向的

2015-01-17 16:38:43 4639

原创 hdu-1213 how many tables

http://acm.hdu.edu.cn/showproblem.php?pid=1213并查集#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include #include #

2015-01-06 20:37:16 604

原创 hdu-1232 畅通工程

http://acm.hdu.edu.cn/showproblem.php?pid=1232并查集#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include #include #

2015-01-06 20:32:36 584

原创 poj-2828 Buy Tickets

http://poj.org/problem?id=2828题意:有n个的排队,每一个人都有一个val来对应,每一个后来人都会插入当前队伍的某一个位置pos。要求把队伍最后的状态输出。逆向思考。这样考虑,最后一个人一定会得到当前队伍他想要的位置,如果我们往前一个阶段,倒数第二个人也一定能得到他想要的位置……,也就是说,我们可以这样处理,我们把最后一个人插入,然后忽略它,再把

2015-01-04 20:12:07 853

原创 hdu-2715 Billboard

http://acm.hdu.edu.cn/showproblem.php?pid=2795转:题意:有一块板,规格为h*w,然后有n张海报,每张海报的规格为1*wi,选择贴海报的位置是:尽量高,同一高度,选择尽量靠左的地方。要求输出每张海报的高度位置。因为最多只有二十万张海报,所以板的最大的长度不会超过二十万,但是要小心,如果板的长度小于h,我们还要用h来建树

2015-01-04 00:48:22 692

原创 hdu-2612 两次bfs

http://acm.hdu.edu.cn/showproblem.php?pid=2612两次bfs, 记录到每个KFC的最短时间。选取最短时间。#include #include #include #include #include #include #include #include #include #include #include #include

2015-01-01 15:33:24 800

g++编译器for c++

g++编译器 c++ this is a program for C++

2014-10-24

空空如也

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

TA关注的人

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