数据结构
SDUTyangkun
这个作者很懒,什么都没留下…
展开
-
数据结构 并查集
数小区 Time Limit: 1000MS Memory limit: 65536K 题目描述某城市有n个人,现在给定关于n个人的m条信息,m条信息是两个人在同一个小区,根据所给信息,判断这个城市最多可能有多少个小区。n个人编号为1~n。输入多组输入。每组第一行有两个整数n,m(2 接下来m行,每行两个整数a,b,表示a和b在同一个小区。输出原创 2016-05-02 19:35:56 · 410 阅读 · 0 评论 -
poj 1068
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 19550 Accepted: 11804DescriptionLet S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two转载 2016-07-26 17:07:51 · 383 阅读 · 0 评论 -
The Pilots Brothers' refrigerator
The Pilots Brothers' refrigeratorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 19011 Accepted: 7277 Special JudgeDescriptionThe game “The Pilots Brothers: following the stripy elephant” ha原创 2016-07-26 21:00:58 · 339 阅读 · 0 评论 -
poj 2506Tiling
TilingTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9204 Accepted: 4378DescriptionIn how many ways can you tile a 2xn rectangle by 2x1 or 2x2 tiles? Here is a sample tiling of a 2x17 rec原创 2016-07-27 08:30:11 · 332 阅读 · 0 评论 -
poj 3295
TautologyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11831 Accepted: 4476DescriptionWFF 'N PROOF is a logic game played with dice. Each die has six faces representing some subset of the原创 2016-07-28 11:27:26 · 314 阅读 · 0 评论 -
poj1789ruck History
ruck HistoryTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 24587 Accepted: 9570DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable de原创 2016-07-29 13:35:12 · 271 阅读 · 0 评论 -
poj 2485 Highways(最小生成树中求最大权值)
HighwaysTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 28287 Accepted: 12880DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So th原创 2016-07-29 15:41:23 · 360 阅读 · 0 评论 -
poj1094Sorting It All Out(拓朴排序)
Sorting It All OutTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 32797 Accepted: 11390DescriptionAn ascending sorted sequence of distinct values is one i原创 2016-08-03 14:36:00 · 339 阅读 · 0 评论 -
poj1094Sorting It All Out(拓朴排序)
Sorting It All OutTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 32797 Accepted: 11390DescriptionAn ascending sorted sequence of distinct values is one原创 2016-08-03 14:50:10 · 338 阅读 · 0 评论 -
fgfdg
#include#includestruct node{ int a,b; double rat,cos;}p[1000];double dis[1000];int m,n,s;double v;int ss;int Bellman_ford(){ memset(dis,0,sizeof(dis)); dis[s] = v; int i,原创 2016-07-30 21:38:19 · 310 阅读 · 0 评论 -
poj3267The Cow Lexicon(简单dp 虽然我并不是很会)
The Cow LexiconTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 9765 Accepted: 4681DescriptionFew know that the cows have their own dictionary with W (1原创 2016-08-03 20:34:31 · 438 阅读 · 0 评论 -
poj3026Borg Maze(bfs+最短路)
Borg MazeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 12709 Accepted: 4149DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy.原创 2016-08-03 09:22:38 · 319 阅读 · 0 评论 -
poj3259Wormholes(bellman判断负环的问题最短路)
WormholesTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 43765 Accepted: 16071DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole原创 2016-07-31 14:38:00 · 282 阅读 · 0 评论 -
poj1035Spell checker(串 暴力~~~)
Spell checkerTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 24417 Accepted: 8910DescriptionYou, as a member of a development team for a new spell check原创 2016-08-04 15:44:52 · 376 阅读 · 0 评论 -
pojLabeling Balls(拓朴 这个题 都说反向建图 好吧 好吧)
Source CodeProblem: 3687 User: 15110501067Memory: 1368K Time: 63MSLanguage: G++ Result: AcceptedSource Code#include#includeint map[500][500];int ans[500]原创 2016-08-03 23:20:52 · 354 阅读 · 0 评论 -
poj 1926 All in all
好喜欢的一个水题啊,就是判断 前一个字符串是否是第二个字符串的字串~~~~~~~,不一定连续#include#includeint main(){ char s1[100010],s2[100010]; while(~scanf("%s%s",s1,s2)) { int len = strlen(s2); int t=0;原创 2016-08-04 16:17:25 · 269 阅读 · 0 评论 -
poj3080 Blue Jeans(串的暴力枚举)
Blue JeansTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16401 Accepted: 7283DescriptionThe Genographic Project is a research partnership between IBM and原创 2016-08-04 19:30:37 · 658 阅读 · 0 评论 -
二分图的最大匹配 ————匈牙利算法 (转载了一个大神的趣味算法) poj3041(Asteroids)
匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。-------等等,看得头大?那么请看下面的版本:通过数代人的努力,你终于赶上了剩男剩女的大潮,假设你是一位光荣的新世纪媒人,在你的手上有N个剩男,M个剩女,每个人都可能对多转载 2016-08-05 08:45:46 · 435 阅读 · 0 评论 -
poj2522 Frogger(最短路变形 所有路径中最长边的最小值)
FroggerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 24879 Accepted: 8076DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting原创 2016-08-01 19:53:55 · 509 阅读 · 0 评论 -
poj2240Arbitrage(最短路 弗洛伊德)
ArbitrageTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20515 Accepted: 8738DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency i原创 2016-08-01 21:29:36 · 492 阅读 · 0 评论 -
poj1125Stockbroker Grapevine(最短路floyd )
Stockbroker GrapevineTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 33842 Accepted: 18697DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a met原创 2016-08-02 14:54:46 · 350 阅读 · 0 评论 -
poj3349SnowflakeSnowSnowflakes(哈希第一次 还不是很了解)
//自己也没啥系统学习哈希表QAQ 只能单上了大家可以参考博客 http://blog.csdn.net/lyy289065406/article/details/6647040 这个大神的博客都很好SnowflakeSnowSnowflakesTime Limit: 4000MS Memory Limit: 65536KTotal Su原创 2016-08-08 15:32:59 · 598 阅读 · 0 评论 -
poj3274
#include#includeconst int N=100100;const int prime=100003;int sum[N][32],c[N][32];int hash[N];int hashcode(int* v,int k){ int p; for(int i=1;i>4))^(v[i] p=p%prime; if原创 2016-08-08 17:26:05 · 394 阅读 · 1 评论 -
TimesIsMoney(二分查找)
TimesIsMoneyTime Limit: 1000MS Memory Limit: 65536KBSubmit StatisticProblem Description给你一个序列,有N个整数(int以内),判断一个数在这个序列中出现几次。Input多组输入,输入到文件结尾首先输入一个n,然后输入n个整数。在输入一个m,代表查询的个原创 2016-08-30 20:11:40 · 482 阅读 · 0 评论 -
poj3253(优先队列 哈夫曼树)
Fence RepairTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 39511 Accepted: 12864DescriptionFarmer John wants to repair a small length of the fence arou原创 2016-08-09 14:25:41 · 367 阅读 · 0 评论 -
POJ1840 Eqs(哈希)
EqsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 15281 Accepted: 7499DescriptionConsider equations(方程式) having the following form:a1x13+ a2x23+ a3x3原创 2016-08-09 15:14:00 · 301 阅读 · 0 评论 -
POJ2002Squares(哈希)
SquaresTime Limit: 3500MS Memory Limit: 65536KTotal Submissions: 18956 Accepted: 7311DescriptionA square is a 4-sided polygon whose sides have equal length and ad原创 2016-08-09 19:41:28 · 324 阅读 · 1 评论 -
poj2442(堆)
#include#include#include#define Max 2008using namespace std;int sum[Max],data[Max],Q[Max];int main(){ int i,j,k,t,m,n,temp; scanf("%d",&t); while(t--) { memset(sum,0,siz原创 2016-08-10 11:14:58 · 355 阅读 · 0 评论 -
poj2442 Sequence(堆)
SequenceTime Limit: 6000MS Memory Limit: 65536KTotal Submissions: 8855 Accepted: 2937DescriptionGiven m sequences(序列), each contains n non-negative(非负的) integer(整数)原创 2016-08-10 19:26:23 · 310 阅读 · 0 评论 -
poj3087(模拟)Shuffle'm Up(简单学习一下map)
Shuffle'm UpTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9277 Accepted: 4256DescriptionA common pastime(娱乐) forpoker(拨火棍) players at a poker table原创 2016-08-12 14:05:39 · 371 阅读 · 0 评论 -
poj Colored Sticks(字典树 欧拉回路的判断 并查集)
E - Colored SticksTime Limit:5000MS Memory Limit:128000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionYou are given a bunch of wooden sticks. Each endpoint of ea原创 2016-08-12 21:09:07 · 434 阅读 · 0 评论 -
顺序表应用6:有序顺序表查询
顺序表应用6:有序顺序表查询Time Limit: 7MS Memory Limit: 700KBProblem Description顺序表内按照由小到大的次序存放着n个互不相同的整数(1<=n<=20000),任意输入一个整数,判断该整数在顺序表中是否存在。如果在顺序表中存在该整数,输出其在表中的序号;否则输出“No Found!"。Input 第一行输入整数n原创 2016-10-08 20:00:38 · 284 阅读 · 0 评论 -
顺序表应用4-2:元素位置互换之逆置算法(数据改进)
顺序表应用4-2:元素位置互换之逆置算法(数据改进)Time Limit: 80MS Memory Limit: 600KBProblem Description一个长度为len(1注意:交换操作会有多次,每次交换都是在上次交换完成后的顺序表中进行。Input第一行输入整数len(1第二行输入len个整数,作为表里依次存放的数据元素;第三行输入整原创 2016-10-08 20:12:05 · 391 阅读 · 0 评论 -
数据结构实验之栈一:进制转换
数据结构实验之栈一:进制转换Time Limit: 1000MS Memory Limit: 65536KBSubmit Statistic DiscussProblem Description输入一个十进制整数,将其转换成对应的R(2Input第一行输入需要转换的十进制数;第二行输入R。Output输出转换所得的R进制数。原创 2016-10-09 08:39:08 · 292 阅读 · 0 评论 -
数据结构实验之链表三:链表的逆置
数据结构实验之链表三:链表的逆置Time Limit: 1000MS Memory Limit: 65536KBSubmit StatisticProblem Description输入多个整数,以-1作为结束标志,顺序建立一个带头结点的单链表,之后对该单链表的数据进行逆置,并输出逆置后的单链表数据。Input输入多个整数,以-1作为结束标志。原创 2016-09-23 10:59:04 · 364 阅读 · 0 评论 -
数据结构实验之链表一:顺序建立链表
数据结构实验之链表一:顺序建立链表Time Limit: 1000MS Memory Limit: 65536KBSubmit StatisticProblem Description输入N个整数,按照输入的顺序建立单链表存储,并遍历所建立的单链表,输出这些数据。Input第一行输入整数的个数N;第二行依次输入每个整数。Output原创 2016-09-23 11:02:18 · 452 阅读 · 0 评论 -
数据结构实验之链表四:有序链表的归并
数据结构实验之链表四:有序链表的归并Time Limit: 1000MS Memory Limit: 65536KBSubmit StatisticProblem Description分别输入两个有序的整数序列(分别包含M和N个数据),建立两个有序的单链表,将这两个有序单链表合并成为一个大的有序单链表,并依次输出合并后的单链表数据。Input第一行原创 2016-09-23 11:20:18 · 814 阅读 · 0 评论 -
数据结构实验之链表五:单链表的拆分
数据结构实验之链表五:单链表的拆分Time Limit: 1000MS Memory Limit: 65536KBSubmit StatisticProblem Description输入N个整数顺序建立一个单链表,将该单链表拆分成两个子链表,第一个子链表存放了所有的偶数,第二个子链表存放了所有的奇数。两个子链表中数据的相对次序与原链表一致。Input原创 2016-09-23 17:30:57 · 461 阅读 · 0 评论 -
数据结构实验之链表六:有序链表的建立
数据结构实验之链表六:有序链表的建立Time Limit: 1000MS Memory Limit: 65536KBSubmit StatisticProblem Description输入N个无序的整数,建立一个有序链表,链表中的结点按照数值非降序排列,输出该有序链表。Input第一行输入整数个数N;第二行输入N个无序的整数。Outpu原创 2016-09-23 18:00:35 · 319 阅读 · 0 评论 -
poj 3007Organize Your Train part II(哈希表 链地址解决冲突)
关键字为整数,冲突解决用单向链表 Hash表建立函数 关键字搜素函数解决方法: (1)采用除留余数法构造哈希函数,冲突解决采用链地址法。 (2)具体的关键字列表为(19,14,23,01,68,20,84,27,55,11,10,79),则哈希函数为H(key)=key MOD 13。则采用除留余数法和链地址法后得到的预想结果应该为:原创 2016-09-23 21:42:07 · 511 阅读 · 0 评论