自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 资源 (3)
  • 收藏
  • 关注

原创 组队赛130829 - from lanshui_Yang

A. Grandpa's Walk        题目大意不再敖述,此题由于数据规模较小,直接用dfs暴力即可,只需注意dfs的起点选取。 代码如下: #include #include #include #include #include #include #include #include #include #define mem(a,b) memset(a,b,sizeof(a)) #

2013-08-30 11:43:52 761

原创 1062 昂贵的聘礼 (spfa + 等级枚举) - from lanshui_Yang

题目是中文的,大意不在敖述。这道题抽象以后就是一个求最短路的问题,只不过,每个点访问的条件有限制,样例建立的有向图如下:

2013-08-30 10:56:13 1245

原创 POJ 1135 Domino Effect (spfa + 枚举)- from lanshui_Yang

Description Did you know that you can use domino bones for other things besides playing Dominoes? Take a number of dominoes and build a row by standing them on end with only a small distance in bet

2013-08-29 15:13:47 1065

原创 POJ 1273 Drainage Ditches(EK) - from lanshui_Yang

题目大意不再敖述,此题是一道基础的最大流。用EK直接水过。。。但要注意,输入中可能存在重边,要记得处理,还有,别忘了处理回流,HDU的题目数据较水(不处理回流也能过)。第一道网络流题目,纪念下。。。        请看代码: #include #include #include #include #include #include #include using namespace std ;

2013-08-29 10:27:12 811

原创 组队赛130827 - from lanshui_Yang

A. Hailstone HOTPO 这是一道水题,直接写就ok,直接上代码: #include #include #include #include #include #include using namespace std ; const int MAXN = 2005 ; int n ; int main() { int T ; scanf("%d" , &T) ;

2013-08-28 15:20:52 772

原创 BNU Flash Mob - from lanshui_Yang

Flash Mob Jumping Jack is in charge of organizing a flash mob. Themembers of the flash mob move around town all day and part of the appeal of thisgroup is they come together to do their thing whenever

2013-08-27 14:08:55 1098

原创 最长上升子序列练习 - from lanshui_Yang

POJ  3903 Stock Exchange :        此题也是简单的最长上升子序列问题,但由于数列长度n较大(n 代码如下: #include #include #include #include #include #include using namespace std ; const int MAXN = 1e5 + 5 ; int s[MAXN] ; int dp[MA

2013-08-26 16:27:31 683

原创 POJ 2533 Longest Ordered Subsequence - from lanshui_Yang

题目大意:求一个数列的最长上升子序列(严格上升)。         解题思路: 方法一:O(n^2) dp[i]:表示处理到第i个位置,序列的最长上升子序列末尾为i的长度; a[]数组存储原序列 dp[i] = max{dp[j]+1},a[i]>a[j],0≤j≤i 方法二:O(nlogn)      复杂度降低其实是因为这个算法里面用到了二分搜索。本来有N个数要处理是O(n),每次

2013-08-26 15:51:17 871

原创 BNU Hexagon Perplexagon - from lanshui_Yang

题目大意:给你7个正六边形,编号0 ~ 6 ,每个六边形的每条边的值均不同,且都是1 ~ 6 。让你按如下方式(a图)拼接: 拼接条件: 1、相邻两条边的值必须相同 2、位于中心的六边形的最上面的边的值必须为1 问这七个六边形能不能完成拼接,如果能,按b图示方式输出各个六边形的编号,即在0位置的先输出,然后输出在1位置的正六边形编号,以此类推。例如:如果编号为 3 的正六边形放在0

2013-08-26 10:58:07 1356

原创 POJ 1458 Common Subsequence - from lanshui_Yang

题目大意:给你连个字符串A 和 B , 让你求A 和 B 的最长公共子序列。          解题思路:此题属简单的DP 问题, 具体讲解推荐以下博客:                     http://blog.csdn.net/yysdsyl/article/details/4226630 我的代码如下: #include #include #include #include

2013-08-23 11:07:31 671

原创 HDU 1003 Max Sum - from lanshui_Yang

Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 +

2013-08-22 21:15:17 1185

原创 HDU 2602 Bone Collector - from lanshui_Yang

题目大意:有n件物品,每件物品均有各自的价值和体积,给你一个容量为 V 的背包,问这个背包最多能装的物品的价值是多少?        解题思路:这是一道0 - 1 背包的简单模板题,也是基础的DP问题,状态转移方程                       f[i][j] = max{ f[ i - 1 ][j] , f[ i - 1 ][ j - v[i] ] + w[i]  }

2013-08-21 22:03:05 985

原创 2013 多校总结 - from lanshui_Yang

多校训练中,主要做的是图论方面的题,以下是部分做出的题目,其他的正在解决中。。        以下是链接:http://write.blog.csdn.net/postlist/1521123/all

2013-08-21 10:32:37 667

原创 2013 多校9 1005 EBCDIC - from lanshui_Yang

题目大意:给你一个字符的EBCDIC码,让你转换成这个字符的ASCII码输出。        解题思路:纯打表,需要细心,另外,应把存字符串的字符数组开得大一点。        请看代码: #include #include #include #include #include #include using namespace std; const int MAXN = 50 ; stri

2013-08-21 09:36:21 1037

原创 BNU 29045 Party Games - from lanshui_Yang

You've been invited to a party. The host wants to divide the guests into 2 teams for party games, with exactly the same number of guests on each team. She wants to be able to tell which guest is on wh

2013-08-19 11:39:16 1085

原创 POJ 1904 King's Quest - from lanshui_Yang

Description Once upon a time there lived a king and he had N sons. And there were N beautiful girls in the kingdom and the king knew about each of his sons which of those girls he did like. The son

2013-08-19 10:56:39 1039

原创 POJ 2553 The Bottom of a Graph - from lanshui_Yang

Description We will use the following (standard) definitions from graph theory. Let V be a nonempty and finite set, its elements being called vertices (or nodes). Let E be a subset of the Cartesian

2013-08-17 11:31:57 980

原创 POJ 2186 Popular Cows - from lanshui_Yang

Description Every cow's dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M <= 50,000) ordered pairs of the form (A, B) that t

2013-08-15 21:40:43 984

原创 POJ 2762 Going from u to v or from v to u? (Tarjan) - from lanshui_Yang

Description In order to make their sons brave, Jiajia and Wind take them to a big cave. The cave has n rooms, and one-way corridors connecting some rooms. Each time, Wind choose two rooms x and y,

2013-08-14 17:23:18 933

原创 POJ 3177 Redundant Paths - from lanshui_Yang

Description In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotte

2013-08-05 22:41:18 1298

原创 ZOJ 2588 Burning Bridges(求含重边的无向连通图的割边) - from lanshui_Yang

Burning Bridges Time Limit: 5 Seconds Memory Limit: 32768 KB Ferry Kingdom is a nice little country located on N islands that are connected by M bridges. All bridges are very beautiful and ar

2013-08-04 14:07:54 1279

原创 POJ 1523、ZOJ 1119 SPF - from lanshui_Yang

Description Consider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis, a failure of a single node, 3, in th

2013-08-03 21:56:58 1138

原创 ZOJ 1654 Place the Robots(超牛的建图思路) - from lanshui_Yang

Place the Robots Time Limit: 5 Seconds Memory Limit: 32768 KB Robert is a famous engineer. One day he was given a task by his boss. The background of the task was the following: Given a map

2013-08-03 09:54:15 1544

原创 POJ 1325、ZOJ 1364、HDU 1150 Machine Schedule - from lanshui_Yang

Problem Description As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of

2013-08-02 21:45:22 1213

原创 HDU 4619 Warm up 2 (2013 多校第二场) - from lanshui_Yang

Problem Description   Some 1×2 dominoes are placed on a plane. Each dominoe is placed either horizontally or vertically. It's guaranteed the dominoes in the same direction are not overlapped, but hor

2013-08-02 14:16:49 1276

树状数组详解

树状数组是高效的查询和修改某区间内数值之和的利器,是程序员的必学知识,更是ACMER的必备技术。

2013-07-24

树状数组的讲解

树状数组是高效的查询和修改某区间内数值之和的利器,是程序员的必学知识,更是ACMER的必备技术。

2013-07-23

空空如也

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

TA关注的人

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