自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(161)
  • 收藏
  • 关注

原创 算法导论-快排

算法导论-快排def quicksort(A,p,r): if p <r: n = partion(A,p,r)#n是基准点,A[p...n-1]<=A[n]<=A[n+1...r] #拆分为2个重复的子问题 quicksort(A,p,n-1) quicksort(A,n+1,r)def partion(A,p,r): x = A[r] i=p-1 # i表示小于x的序列的迭代器,最终的序列形

2021-04-07 22:22:55 151

原创 hdu1532-Drainage Ditches(最大流&EK)

Drainage DitchesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16292 Accepted Submission(s): 7737Problem Description Every time it rains o

2017-02-09 21:43:45 549

原创 hdu3549-Flow Problem(最大流&EK)

Flow ProblemTime Limit: 5000/5000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 14791 Accepted Submission(s): 6960Problem Description Network flow is a well-kn

2017-02-09 19:56:38 451

原创 POJ1797-Heavy Transportation(Dijkstra 变式& 最大生成树)

Heavy Transportation Time Limit: 3000MS Memory Limit: 30000K Total Submissions: 32337 Accepted: 8567 DescriptionBackground Hugo Heavy is happy. After the breakdown of the Cargolifter p

2017-02-08 21:38:58 745 1

原创 POJ2253-Frogger(Dijkstra变式)

Frogger Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 40814 Accepted: 13096 DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona F

2017-02-08 18:28:46 403

原创 POJ2387 - Til the Cows Come Home(Dijkstra)

Til the Cows Come Home Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 48111 Accepted: 16379 DescriptionBessie is out in the field and wants to get back to the barn to get as

2017-02-08 16:23:41 423

原创 hdu1233-还是畅通工程(Kruskal)

还是畅通工程 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input 测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( < 100 );随后的N(N-1)/2行对应村庄间的距离,每

2017-02-07 13:18:41 387

转载 MST唯一性判断

fzu2087 统计树边解法(mengxiang000000 )如果安全,则先不Union,先统计最小生成树的边数,待统计完后再Union; poj1679 与此题类似fzu2087#include#includeusing namespace std;const int maxn=100005;typedef struct node{ int st,ed,cos

2017-02-07 12:57:58 2423

原创 hdu1875-畅通工程再续(Kruskal )

畅通工程再续Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 26109 Accepted Submission(s): 8459Problem Description 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的

2017-02-07 12:33:25 319

原创 POJ1251- Jungle Roads(Kruskal)

Jungle Roads Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24836 Accepted: 11691 DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of fore

2017-02-07 12:30:40 321

原创 POJ1861-Network(Kruskal)

Network Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16497 Accepted: 6545 Special Judge DescriptionAndrew is working as system administrator and is planning to establi

2017-02-07 00:41:08 333

原创 hdu1863-畅通工程(Prime & Kruskal)

畅通工程Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 27327 Accepted Submission(s): 11956Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通

2017-02-06 18:57:18 348

原创 hdu2544 -最短路(Bellman-Ford)

最短路Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 58761 Accepted Submission(s): 25851Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shir

2017-02-06 16:55:12 321

原创 HDU2112-HDU Today(Floyd & Dijkstra)

HDU TodayTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 26744 Accepted Submission(s): 6517Problem Description 经过锦囊相助,海东集团终于度过了危机,从此,HDU的发

2017-02-05 18:16:47 427

原创 堆结构

堆的主要操作:*建立一个堆 *往堆里添加新元素 *访问最大/最小值 *删除最大/最小值模板如下:#include<cstdio>#define MAX_SIZE 100int A[MAX_SIZE]={0,1,2,3,4,5,6,7,8,9},N=9; //下标从1开始 void downAdjustment(int A[],int idx);//向下调整 void buildHeap(

2017-02-04 21:05:16 375

原创 POJ 2533-Longest Ordered Subsequence(裸LIS)

Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 49498 Accepted: 21975 DescriptionA numeric sequence of ai is ordered if a1 < a2 < … < aN. Let the s

2017-02-04 18:07:34 394

原创 POJ1651 Multiplication Puzzle(DP矩阵链)

Multiplication Puzzle Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9500 Accepted: 5906 DescriptionThe multiplication puzzle is played with a row of cards, each containing a si

2017-02-03 17:24:15 269

原创 hdu1248寒冰王座(完全背包)

寒冰王座Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16247 Accepted Submission(s): 8365Problem Description 不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(记住,只有一张

2017-02-02 07:22:46 416

原创 Codeforces761A. Dasha and Stairs

A. Dasha and Stairs time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output On her way to programming school tiger Dasha faced her first test — a

2017-02-01 20:20:16 661

原创 hdu1394 -Minimum Inversion Number(线段树求逆序数)

Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19106 Accepted Submission(s): 11520Problem Description The inversio

2017-02-01 16:58:01 343

原创 Codeforces761B. Dasha and friends (KMP)

B. Dasha and friends time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Running with barriers on the circle track is very popular in the coun

2017-02-01 09:04:47 403

原创 hdu1754 - I Hate It(线段树RMQ)

I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 69021 Accepted Submission(s): 26782Problem Description 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到

2017-01-29 05:06:03 290

原创 HDU1166 -敌兵布阵(线段树)

敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 82209 Accepted Submission(s): 34700Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Der

2017-01-29 03:51:03 278

原创 hdu1846-Brave Game(BashGame入门)

Brave GameTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 11154 Accepted Submission(s): 7490Problem Description 十年前读大学的时候,中国每年都要从国外引进一些电影大片

2017-01-28 21:33:45 245

原创 Codeforces724D. Arpa's weak amphitheater and Mehrdad's valuable Hoses(并查集+背包)

D. Arpa’s weak amphitheater and Mehrdad’s valuable Hoses time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Just to remind, girls in Arpa’s la

2017-01-28 20:53:20 564

原创 POJ3624 - Charm Bracelet(01背包)

Charm Bracelet Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 36471 Accepted: 15980 DescriptionBessie has gone to the mall’s jewelry store and spies a charm bracelet. Of cour

2017-01-28 20:36:39 298

原创 百练2950:摘花生(模拟)

2950:摘花生 查看 提交 统计 提示 提问 总时间限制: 1000ms 内存限制: 65536kB 描述 鲁宾逊先生有一只宠物猴,名叫多多。这天,他们两个正沿着乡间小路散步,突然发现路边的告示牌上贴着一张小小的纸条:“欢迎免费品尝我种的花生!——熊字”。 鲁宾逊先生和多多都很开心,因为花生正是他们的最爱。在告示牌背后,路边真的有一块花生田,花生植株整齐地排列成矩形网格(如图1)。有经验

2017-01-28 20:34:19 403

原创 百练1833:排列(stl:next_permutation)

1833:排列 查看 提交 统计 提示 提问 总时间限制: 5000ms 内存限制: 65536kB 描述 题目描述: 大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。任务描述: 给出某个排列,求出这个排列的下k个排列,如果遇到最后一个

2017-01-28 20:32:16 350

原创 hdu 1599 Common Subsequence(DP)

Problem Description A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, …, xm> another sequence Z = < z1, z2, …, zk> is

2017-01-28 20:27:11 233

原创 Codevs1078 最小生成树( kruskal )

题目描述 Description 农民约翰被选为他们镇的镇长!他其中一个竞选承诺就是在镇上建立起互联网,并连接到所有的农场。当然,他需要你的帮助。 约翰已经给他的农场安排了一条高速的网络线路,他想把这条线路共享给其他农场。为了使花费最少,他想铺设最短的光纤去连接所有的农场。 你将得到一份各农场之间连接费用的列表,你必须找出能连接所有农场并所用光纤最短的方案。 每两个农场间的距离不会超过100000

2017-01-24 06:53:49 356

原创 hdu2191- 悼念512汶川大地震遇难同胞――珍惜现在,感恩生活(多重背包)

Problem Description 急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢?后记: 人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。 月有阴晴圆缺,人有旦夕

2017-01-23 23:17:48 395

原创 hdu1003 Max Sum(dp)

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 + 4 =

2017-01-23 22:41:29 285

原创 Codeforces59 B - Fortune Telling(再水)

B. Fortune Telling time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Marina loves Sasha. But she keeps wondering whether Sasha loves her. Of

2017-01-23 01:20:44 596

原创 Codeforces59A - Word(水)

A. Word time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Vasya is very upset that many people on the Net mix uppercase and lowercase letter

2017-01-23 01:18:21 640

原创 插入排序&归并排序&堆排序

插入排序#include<stdio.h>void insertion_sort(int *arr,int len){ int i,j; int temp; for(int i=1;i<len;i++){ temp=arr[i]; j=i-1; for(;j>=0 && arr[j]>temp;j--){

2017-01-22 18:59:42 257

原创 POJ-3126 Prime Path(BFS 求最小步数)

DescriptionThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a m

2017-01-22 04:31:31 334

原创 POJ-1426 Find The Multiple ( BFS )

http://poj.org/problem?id=1426 Find The Multiple Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 28996 Accepted: 12023 Special Judge DescriptionGiven a positive integer n

2017-01-21 23:32:22 350

原创 POJ-1787 Charlie's Change( 多重背包记录方案)

http://poj.org/problem?id=1787 Charlie’s Change Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4238 Accepted: 1325 DescriptionCharlie is a driver of Advanced Cargo Movement, Lt

2017-01-21 15:04:12 920

原创 UVA562 Dividing coins (01背包)

Dividing coins Description It’s commonly known that the Dutch have invented copper-wire. Two Dutch men were fighting over a nickel, which was made of copper. They were both so eager to get it and the

2017-01-21 08:17:22 463

原创 POJ 3624- Charm Bracelet(01背包 滚动数组)

Charm Bracelet Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 36395 Accepted: 15944 DescriptionBessie has gone to the mall’s jewelry store and spies a charm bracelet. Of cour

2017-01-21 07:32:28 297

空空如也

空空如也

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

TA关注的人

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