自定义博客皮肤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

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

原创 LightOJ 1184 - Marriage Media 【二分图最大匹配】

题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1184根据一些要求建图即可代码:#include <iostream> #include <algorithm> #include <set> #include <map> #include <string.h> #include <queue> #incl

2015-08-27 04:47:03 654

原创 LightOJ 1201 - A Perfect Murder【二分图最大独立集】

链接:http://www.lightoj.com/volume_showproblem.php?problem=1201最大独立集= 顶点数- 最大匹配代码:#include <iostream> #include <algorithm> #include <set> #include <map> #include <string.h> #include <queue> #

2015-08-26 21:02:31 765

原创 LightOJ 1149 - Factors and Multiples【二分图最大匹配】

题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1149代码:#include <iostream> #include <algorithm> #include <set> #include <map> #include <string.h> #include <queue> #include <sstre

2015-08-26 19:38:50 548

原创 UVA 10968 - KuPellaKeS 【BFS】

题目: In ancient times, many territories were under the control of a powerful king called Basm. Basm is well-known in history because of his strange works and as a result, there are many history-lovers

2015-08-26 02:15:58 669

原创 poj 3687 Labeling Balls 【拓扑排序】

题目链接:http://poj.org/problem?id=3687注意重边代码:#include <stdio.h> #include <ctime> #include <math.h> #include <limits.h> #include <complex> #include <string> #include <functional> #include <it

2015-08-25 20:49:26 711

原创 poj 2686 Traveling by Stagecoach【状态压缩】

题目链接:http://poj.org/problem?id=2686题意: 一个人从某个城市要到另一个城市。然后有n个马车票,相邻的两个城市走的话要消耗掉一个马车票。花费的时间是马车票上有个速率值,用边/速率就是花的时间。 问最后这个人花费的最短时间是多少dp[i][j] 表示集合 i 车票 到 j 的最优解代码:#include <stdio.h> #include <ctime>

2015-08-24 21:03:44 616

原创 hdu 5418 Victor and World【状态压缩】

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5418题意:从1出发 每个点至少经过一次 最后回到1点的最短路径首先用floyd处理点之间的最短距离 再状压求解代码:#include <stdio.h> #include <ctime> #include <math.h> #include <limits.h> #include <c

2015-08-24 11:11:03 647

原创 hdu 5115 Dire Wolf【区间DP】

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5115题意: 有n只狼,每只狼有两种属性,一种攻击力一种附加值,我们没杀一只狼,那么我们受到的伤害值为这只狼的攻击值与它旁边的两只狼的附加值的和,求把所有狼都杀光受到的最小的伤害值。代码:#include <stdio.h> #include <ctime> #include <math.h>

2015-08-20 02:23:39 672

原创 Codeforces Round #316 (Div. 2)

A http://codeforces.com/contest/570/problem/A 随便搞一下int n, m;long long cnt[1000];struct node{ long long nb; long long sum;}res[1000],ans[1000];bool cmp(node a, node b){ if (a.sum != b.s

2015-08-20 00:55:59 66

原创 hdu 4292 Food【拆点网络流】

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4292解法:拆人代码:#include <stdio.h> #include <ctime> #include <math.h> #include <limits.h> #include <complex> #include <string> #include <functiona

2015-08-19 03:33:28 658

原创 UVA 11997 K Smallest Sums

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3148题意:给定k个数组,每个数组k个数字,要求每个数字选出一个数字,构成和,这样一共有kk种情况,要求输出最小的k个和 其实只要能求出2组的前k个值,然后不断两两合并就可以了代码:#incl

2015-08-18 20:13:45 604

原创 UVA 1329 Corporative Network【并查集】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4075题意: 有n个结点,开始都是单独的结点,现在有I操作和E操作,I u v表示吧u的父亲结点设为,距离为|u - v| % 1000,E操作询问u到根的距离代码:#include <std

2015-08-17 20:20:30 577

原创 UVA 1160 X-Plosives【并查集】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3601题意: 每次给定一个两个元素a,b组成的化合物,如果车上有k个化合物,又包含了k个元素,就会形成爆炸物,所以每次装上去前要检查一下,输入一些化合物,求不能装的个数代码:#include

2015-08-17 19:55:25 703

原创 UVA 1203 Argus【优先队列】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3644题意: 给定一些注册命令,表示每隔时间t,执行一次编号num的指令,注册命令结束后,给定k,输出前k个执行顺序代码:#include <stdio.h>#include <iostre

2015-08-17 19:39:25 745

原创 UVA 11991 Easy Problem from Rujia Liu?【STL】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3142题意: 给一个长度n的序列,有m询问,每个询问会问第k个出现的数字的下标是多少 用map记录代码:#include <stdio.h>#include <iostream>#inc

2015-08-17 19:21:37 578

原创 UVA 11995 I Can Guess the Data Structure!【模拟】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3146题意: 给定一堆的操作,问这个数据结构是什么代码:#include <stdio.h>#include <iostream>#include <algorithm>#include

2015-08-17 18:05:02 105

原创 UVA 10746 Crime Wave - The Sequel【最小费用最大流】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1687题意:给你n个城市到m个海港的距离,求每个城市都有船只去的最短平均航行距离。源点向城市建边 城市向海港 海港向汇点建边 容量为1,最后城市向海港的费用为距离代码:#include<stdi

2015-08-16 13:32:45 642

原创 UVA 10369 Arctic Network【最小生成树】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1310题意: 有m个卫星,n个站点,卫星可以不用代价相连,剩下要用无线电连,求无线电连接中最大距离的最小解法: 最小边开始加入,这样第n - m 条边的权值就是答案代码:略

2015-08-14 00:46:52 846

原创 UVA 558 Wormholes 【SPFA 判负环】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=499题意:就是判断图中有无负环 SPFA,某个节点入队次数大于n就是有负环。代码:#include <iostream>#include <stdio.h>#include <string

2015-08-14 00:11:26 763

原创 UVA 10986 Sending email 【dijkstra + 堆优化】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1927题意:n个点m条边,求s到e的最短距离代码:#include<stdio.h>#include<iostream>#include<math.h>#include<stdlib.h>

2015-08-13 23:47:11 809

原创 hdu 4858 项目管理

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4858题意:中文不解释解法:直接按题意模拟一遍,数据水?代码:#include<stdio.h>#include<iostream>#include<math.h>#include<stdlib.h>#include<ctype.h>#include<algorithm>#include<ve

2015-08-13 21:32:33 802

原创 hdu 4857 逃生【反向拓扑排序】

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4857题意:中文不解释解法:input: 1 3 1 3 1 answer: 3 1 2 而不是 2 3 1 所以逆向建边 拓扑代码:#include<stdio.h>#include<iostream>#include<math.h>#include<stdlib.h>#in

2015-08-13 21:06:43 711

原创 hdu 5371 Hotaru's problem【manacher】

题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5371题意: 给出一个长度为n的串,要求找出一条最长连续子串。这个子串要满足:1:可以平均分成三段,2:第一段和第三段相等,3:第一段和第二段回文。求最大子串的长度。代码:#include<stdio.h>#include<iostream>#include<math.h>#include<s

2015-08-13 01:30:19 688

原创 UVA 10269 Adventure of Super Mario 【最短路 + dp】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1210题意: 给你a(1~a)个村子 b(a+1 ~ b)个城堡 ,m条路, 问你回家(a+b 到 1)花费的最少能量.你有魔法鞋子,每次最多可以走L长的距离且不花费能量,最多使用K次,魔法鞋

2015-08-12 20:04:51 659

原创 UVA 10608 Friends【并查集】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1549题意:给定n个人m种朋友关系,求最大朋友圈的人数。裸并查集代码:#include <stdio.h>#include <iostream>#include <string.h>#i

2015-08-12 16:25:09 606

原创 UVA 10099 The Tourist Guide【floyd】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1040题意: n个点,m条路径,每条路径最多通过人数最多为value人,求把v个游客从a点运送到b点,需要几辆车,注意导游自己也算一个人。 思路:floyd找出两点间最大运送量,然后计算需要

2015-08-12 16:02:51 530

原创 UVA 10034 Freckles 【最小生成树】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=975题意:裸的最小生成树代码:#include <stdio.h>#include <iostream>#include <string.h>#include <algorithm>#i

2015-08-12 11:08:25 757

原创 UVA 567 Risk【floyd】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=508题意:20个点的任意最短路。floyd代码:#include <stdio.h>#include <ctime>#include <math.h>#include <string>#

2015-08-12 10:49:18 569

原创 UVA 10457 - Magic Car【最小瓶颈树】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=600&problem=1398&mosmsg=Submission+received+with+ID+14106648题意: m条路,每条路上必须维持速度v,现在有一辆车,启动能量和结束能量

2015-08-10 21:04:54 685

原创 UVA 707 - Robbery【记忆化搜索】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=599&problem=648&mosmsg=Submission+received+with+ID+14106133题意: 在一个w * h的图上,t个时刻,然后给你一些信息,知道某些时刻没

2015-08-10 16:05:16 751

原创 UVA 538 - Balancing Bank Accounts

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=599&problem=479&mosmsg=Submission+received+with+ID+14105881题意: 给定一些人的欠钱关系,要求在n-1次内还清钱,问方案解法:所有人与

2015-08-09 23:55:55 769

原创 UVA 11573 - Ocean Currents【BFS+优先队列】

题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2620题意:给定一个海面,数字分别代表海流方向,顺着海流不用费能量,逆海流要费1点能量,每次询问给一个起点一个终点,问起点到终点耗费的最小能量思路:广搜,队列用优先队列,每次取能量最低的点。代码

2015-08-09 20:37:27 649

原创 poj 1088 滑雪【记忆化搜索】

题目链接:http://poj.org/problem?id=1088基础题,不讲了,吃早饭去。。。代码:#include <stdio.h>#include <iostream>#include <algorithm>#include <string.h>#include <queue>#include <math.h>#include <map>#include <string>u

2015-08-09 08:53:40 555

原创 UVA 11748 Rigging Elections 【dfs】

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2848 题意:n个人选举,给出m个人的投票人对于每个人的优先级,想让第c个人赢,问能不能思路:对于两个人上场,如果a能赢b,就建一条a->b的边,然后问题其实就变成能否以c为根节点是一棵树,直接dfs一遍即

2015-08-08 21:26:48 452

原创 UVA 436 Arbitrage (II)【floyd】

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=377题意:硬币兑换,能不能兑换一圈使得手中的钱变多。 floyd传递闭包。代码:#include <stdio.h>#include <iostream>#include <algorithm>#in

2015-08-08 20:22:44 413

原创 UVA 534 Frogger 【最小瓶颈树】

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=475题意:求点1到2所有路径上最大边的最小值。解法:Kruskal按边值排序。直到1,2联通。代码:#include <stdio.h>#include <iostream>#include <algor

2015-08-08 18:49:04 1166

原创 UVA 10441 Catenyms【欧拉路】

题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=41674题意:给定一些单词,如果一个单词的尾字母与另一个的首字母相同则可以连接。问是否可以每个单词用一次,将所有单词连接,可以则输出字典序最小的序列。代码:#include <stdio.h>#include <ctime>#include <math.h>

2015-08-08 16:41:07 534

原创 UVA 1423 Guess 【拓扑排序】

题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=36239题意:给你序列的区间和的正负,要求构造一组序列满足条件。 转换为前缀和,进行拓扑序列。代码:#include<stdio.h>#include<iostream>#include<algorithm>#include<string.h>#incl

2015-08-08 16:21:49 716

原创 poj 2526 Minimum Cost【最小费用最大流】

题目链接:http://poj.org/problem?id=2516题意: n个店主 m个供应商 k种货物 给你店主对k种货物的需求及供货商k种货物的囤货量及K种运输费用。解法:k次费用流,分别求每种货物的费用。源点到供应点建边,店主到汇点建边,费用均为0,容量为1。然后供应点到店主建边,费用为矩阵,容量无穷大即可。代码:/*POJ 2195 Going Home邻接矩阵形式最小费用最大流

2015-08-08 13:38:11 683

原创 poj 1087 A Plug for UNIX 【最大流】

题目连接:http://poj.org/problem?id=1087题意: n种插座 ,m个电器,f组(x,y)表示插座x可以替换插座y,问你最多能给几个电器充电。解法:起点向插座建边,容量1,电器向汇点建边,容量1,插座向电器建边,容量1,可以替换的插座间建边,容量无穷大。然后套板子。。。求最大流。代码:#include <stdio.h> #include <ctime> #incl

2015-08-08 00:35:43 871

g++编译器for c++

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

2014-10-24

空空如也

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

TA关注的人

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