数据结构
文章平均质量分 63
sunshine668
这个作者很懒,什么都没留下…
展开
-
UVA 11995 I Can Guess the Data Structure!
DescriptionProblem II Can Guess the Data Structure!There is a bag-like data structure, supporting two operations:1 xThrow an element x into the bag.2Take out an element from th原创 2014-04-03 15:44:31 · 389 阅读 · 0 评论 -
根据二叉树先序中序序列输出后序
#include #include #include #include #include using namespace std;#define inf 0x3f3f3f3ftypedef struct node{ char x; struct node *lc,*rc;}node,*tree;char pre[100],in[100],post[100];v原创 2016-03-13 19:49:41 · 1227 阅读 · 0 评论 -
链式前向星 模板
#include#include#includeconst int maxn = 10005;const int maxm = 1000005;//edgeusing namespace std;int n;struct node{int to,next;// int value ,from,};node edge [maxm];int box[原创 2014-10-17 16:16:07 · 495 阅读 · 0 评论 -
栈的应用
判断回文串:原创 2014-11-02 15:26:46 · 348 阅读 · 0 评论 -
hdu 1022 Train Problem I
Problem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is t原创 2014-10-04 14:51:58 · 285 阅读 · 0 评论 -
hdu 2094 产生冠军 拓扑排序
Problem Description有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。球赛的规则如下:如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。如果A打败了B,B又打败了C,而且,C又打败了A,那么A、B、C三者都不可能成为冠军。根据这个规则,无需循环较量,或许就能确定冠军。你的任务就是面对一群比赛选手,在经过了若干原创 2014-08-04 15:38:05 · 456 阅读 · 0 评论 -
hdu 2647 Reward 拓扑排序
Problem DescriptionDandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a trouble about how to distribute the reward原创 2014-08-04 14:52:06 · 368 阅读 · 0 评论 -
hdu 1811Rank of Tetris 拓扑+并查集
Problem Description自从Lele开发了Rating系统,他的Tetris事业更是如虎添翼,不久他遍把这个游戏推向了全球。为了更好的符合那些爱好者的喜好,Lele又想了一个新点子:他将制作一个全球Tetris高手排行榜,定时更新,名堂要比福布斯富豪榜还响。关于如何排名,这个不用说都知道是根据Rating从高到低来排,如果两个人具有相同的Rating,那就按这几个人的RP原创 2014-08-04 19:49:22 · 315 阅读 · 0 评论 -
hdu 1285 确定比赛名次 拓扑排序
Problem Description有N个比赛队(1 Input输入有若干组,每组中的第一行为二个数N(1 Output给出一个符合要求的排名。输出时队伍号之间有空格,最后一名后面没有空格。其他说明:符合条件的排名可能不是唯一的,此时要求输出时编号小的队伍在前;输入数据保证是正确的,即输入数据确保一定能有一个符合要求的排名。 S原创 2014-08-04 14:27:43 · 335 阅读 · 0 评论 -
Genealogical tree 拓扑排序
DescriptionThe system of Martians' blood relations is confusing enough. Actually, Martians bud when they want and where they want. They gather together in different groups, so that a Martian can原创 2014-07-05 21:56:13 · 339 阅读 · 0 评论 -
优先队列
例子:#include#include#include#includeusing namespace std;//定义比较结构struct cmp1{ bool operator ()(int &a,int &b){ return a>b;//最小值优先 }};struct cmp2{ bool operator ()(int &a,转载 2014-07-24 10:12:43 · 309 阅读 · 0 评论 -
poj 3253Fence Repair
DescriptionFarmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer len原创 2014-07-24 09:39:40 · 273 阅读 · 0 评论 -
poj 3750小孩报数问题
Description有N个小孩围成一圈,给他们从1开始依次编号,现指定从第W个开始报数,报到第S个时,该小孩出列,然后从下一个小孩开始报数,仍是报到S个出列,如此重复下去,直到所有的小孩都出列(总人数不足S个时将循环报数),求小孩出列的顺序。Input第一行输入小孩的人数N(N接下来每行输入一个小孩的名字(人名不超过15个字符) 最后一行输入W,S (W Outp原创 2014-07-23 09:55:42 · 1446 阅读 · 0 评论 -
UVA 11991 Easy Problem from Rujia Liu?
DescriptionProblem EEasy Problem from Rujia Liu?Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, o原创 2014-04-03 15:28:58 · 398 阅读 · 0 评论 -
先序建二叉树,中序遍历
#include#include#includeusing namespace std;typedef struct node{ char x; struct node* lc,* rc;}node,*tree;char s[1000];int m;void build(tree &t){ int l=strlen(s); if(m>=l) re原创 2016-02-29 20:30:23 · 337 阅读 · 0 评论