上一页 1 ··· 79 80 81 82 83 84 85 86 87 ··· 94 下一页

2011年8月10日

ACM HDU 2444 The Accomodation of Students(判断是否为二部图,然后求最大匹配)

摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2444题意: 有n个学生,有m对人是认识的,每一对认识的人能分到一间房,问能否把n个学生分成两部分,每部分内的学生互不认识,而两部分之间的学生认识。如果可以分成两部分,就算出房间最多需要多少间,否则就输出No。分析:先是要判断是否为二部图,然后求最大匹配。这里的程序hungary()用vector实现/*HDU 2444 The Accomodation of Students*/#include<iostream>#include<string.h>#include< 阅读全文

posted @ 2011-08-10 16:51 kuangbin 阅读(716) 评论(0) 推荐(1) 编辑

2011年8月9日

HDU 1045 Fire Net(建模,用二分匹配)

摘要: Fire NetTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2349Accepted Submission(s): 1342Problem DescriptionSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a st 阅读全文

posted @ 2011-08-09 21:34 kuangbin 阅读(3314) 评论(0) 推荐(0) 编辑

二分图匹配(匈牙利算法模板)

摘要: 一、最大匹配——匈牙利算法/****************************************************二分图匹配(匈牙利算法的DFS实现)INIT:g[][]两边定点划分的情况CALL:res=hungary();输出最大匹配数优点:适于稠密图,DFS找增广路快,实现简洁易于理解时间复杂度:O(VE);****************************************************/const int MAXN=1000;int uN,vN; //u,v数目int g[MAXN][MAXN];//编号是0~n-1的 int linker[M 阅读全文

posted @ 2011-08-09 21:32 kuangbin 阅读(5375) 评论(5) 推荐(2) 编辑

POJ 1220 NUMBER BASE CONVERSION(高精度进制转换)

摘要: NUMBER BASE CONVERSIONTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 3231Accepted: 1394DescriptionWrite a program to convert numbers in one base to numbers in a second base. There are 62 different digits: { 0-9,A-Z,a-z } HINT: If you make a sequence of base conversions using the output of 阅读全文

posted @ 2011-08-09 16:28 kuangbin 阅读(727) 评论(0) 推荐(0) 编辑

高精度的进制转换!!!!

摘要: 前面的内容来源于:http://www.cnblogs.com/phinecos/archive/2009/09/11/1564975.html引用原文:在数据结构课关于栈的这一章中,我们都学过用“模2取余法”来将一个10进制数转换为一个二进制数,进而可以推广到“模n取余法”,经其转换为n进制(n任意指定)。确实,这是一个很基础的题目,可你是否想过如果这个10进制数是一个大数(其位数可能上千位,此时用一般数据类型肯定是会溢出的),那么这个问题又如何来求解呢?当然,也许你会说很简单嘛,自己写一个大数类(当然至少要写一个大数除法才行),或者你用的是Java这种现代化语言,就更轻松了,直接用BigI 阅读全文

posted @ 2011-08-09 16:23 kuangbin 阅读(6263) 评论(0) 推荐(2) 编辑

2011年8月8日

ACM HDU 2063 过山车(简单的二分匹配)

摘要: 过山车Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2978Accepted Submission(s): 1222Problem DescriptionRPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只 阅读全文

posted @ 2011-08-08 16:55 kuangbin 阅读(723) 评论(0) 推荐(0) 编辑

ACM HDU 3466 Proud Merchants(某种顺序下的背包)

摘要: Proud MerchantsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 925Accepted Submission(s): 368Problem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result 阅读全文

posted @ 2011-08-08 16:16 kuangbin 阅读(436) 评论(1) 推荐(0) 编辑

ACM HDU 3460 Ancient Printer(简单题)

摘要: Ancient PrinterTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 704Accepted Submission(s): 309Problem DescriptionThe contest is beginning! While preparing the contest, iSea wanted to print the teams' names separately on a single paper.Unfortuna 阅读全文

posted @ 2011-08-08 12:51 kuangbin 阅读(904) 评论(0) 推荐(0) 编辑

2011年8月7日

POJ 3180 The Cow Prom (求强连通分量结点数>=2的个数)

摘要: The Cow PromTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 643Accepted: 384DescriptionThe N (2 <= N <= 10,000) cows are so excited: it's prom night! They are dressed in their finest gowns, complete with corsages and new shoes. They know that tonight they will each try to perform 阅读全文

posted @ 2011-08-07 22:53 kuangbin 阅读(854) 评论(0) 推荐(0) 编辑

POJ 1236 Network Of Schools (强连通分量缩点求出度为0的和入度为0的分量个数)

摘要: 这个结合上题,类似的代码解决的:http://www.cnblogs.com/kuangbin/archive/2011/08/07/2130062.htmlNetwork of SchoolsTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 5354Accepted: 2106DescriptionA number of schools are connected to a computer network. Agreements have been developed among those schools: each sch 阅读全文

posted @ 2011-08-07 21:31 kuangbin 阅读(4007) 评论(0) 推荐(2) 编辑

上一页 1 ··· 79 80 81 82 83 84 85 86 87 ··· 94 下一页

导航

JAVASCRIPT: