上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页
摘要: 两种表示方式 邻接矩阵 邻接表 无向图 $|V|+2|E|$存储空间 有向图 出边表入边表之一 $|V|+|E|$ 十字链表 data域 firstinarc指针指向第一条以该顶点为终点的边 firstoutarc指针指向第一条以该顶点为起点的边 邻接矩阵 邻接表 无向图 $|V|+2|E|$存储空 阅读全文
posted @ 2018-12-06 13:57 TobicYAL 阅读(421) 评论(0) 推荐(0) 编辑
摘要: 发现他,抓住他(10分) 题目内容: 一个城市中有两个犯罪团伙A和B,你需要帮助警察判断任意两起案件是否是同一个犯罪团伙所为,警察所获得的信息是有限的。假设现在有N起案件(N<=100000),编号为1到N,每起案件由团伙A或团伙B所为。你将按时间顺序获得M条信息(M<=100000),这些信息分为 阅读全文
posted @ 2018-12-05 22:50 TobicYAL 阅读(1590) 评论(0) 推荐(0) 编辑
摘要: 求逆序对数(10分) 求逆序对数(10分) 题目内容: 对于一个长度为N的整数序列A,满足i < j 且 Ai > Aj.的数对(i,j)称为整数序列A的一个逆序<j<=n且ai><j<=n且ai><j<=n且ai><j<=n且ai> 请求出整数序列A的所有逆序对个数 输入格式: 输入包含多组测试数 阅读全文
posted @ 2018-11-28 15:04 TobicYAL 阅读(593) 评论(0) 推荐(0) 编辑
摘要: 描述 Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering problems, all 阅读全文
posted @ 2018-11-26 19:33 TobicYAL 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 描述 FJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) cows. A set of paths of various lengths ru 阅读全文
posted @ 2018-11-26 19:29 TobicYAL 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 描述 As you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers 阅读全文
posted @ 2018-11-23 18:19 TobicYAL 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 兔子与星空(10分) 题目内容: 很久很久以前,森林里住着一群兔子。兔子们无聊的时候就喜欢研究星座。如图所示,天空中已经有了n颗星星,其中有些星星有边相连。兔子们希望删除掉一些边,然后使得保留下的边仍能是n颗星星连通。他们希望计算,保留的边的权值之和最小是多少? 输入格式: 第一行只包含一个表示星星 阅读全文
posted @ 2018-11-20 15:41 TobicYAL 阅读(951) 评论(0) 推荐(0) 编辑
摘要: 描述 Consider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis 阅读全文
posted @ 2018-11-16 18:42 TobicYAL 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 描述 Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exch 阅读全文
posted @ 2018-11-16 18:38 TobicYAL 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 二叉树的深度(10分) 题目内容: 给定一棵二叉树,求该二叉树的深度 二叉树深度定义:从根结点到叶结点依次经过的结点(含根、叶结点)形成树的一条路径,最长路径的节点个数为树的深度 输入格式: 第一行是一个整数n,表示二叉树的结点个数。二叉树结点编号从1到n,根结点为1,n <= 10 接下来有n行, 阅读全文
posted @ 2018-11-13 15:28 TobicYAL 阅读(780) 评论(0) 推荐(0) 编辑
摘要: 描述 Caocao was defeated by Zhuge Liang and ZhouYu in the battle of Chibi. But he wouldn't give up. Caocao's army still was not good at water battles, s 阅读全文
posted @ 2018-11-08 09:53 TobicYAL 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 描述 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 阅读全文
posted @ 2018-11-08 09:47 TobicYAL 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 描述 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) o 阅读全文
posted @ 2018-11-08 09:31 TobicYAL 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 题目内容: 我们知道如何按照三种深度优先次序来周游一棵二叉树,来得到中根序列、前根序列和后根序列。反过来,如果给定二叉树的中根序列和后根序列,或者给定中根序列和前根序列,可以重建一二叉树。本题输入一棵二叉树的中根序列和后根序列,要求在内存中重建二叉树,最后输出这棵二叉树的前根序列。 用不同的整数来唯 阅读全文
posted @ 2018-11-02 20:41 TobicYAL 阅读(2364) 评论(0) 推荐(0) 编辑
摘要: 描述 Biologists finally invent techniques of repairing DNA that contains segments causing kinds of inherited diseases. For the sake of simplicity, a DNA 阅读全文
posted @ 2018-10-29 23:26 TobicYAL 阅读(442) 评论(0) 推荐(0) 编辑
摘要: 描述 有若干种病毒,每种病毒的特征代码都是一个01串。 每个程序也都是一个01串。 问是否存在不被病毒感染(不包含任何病毒的特征代码)的无限长的程序。 输入第一行是整数n,表示有n个病毒接下来n行,每行是一个由 0,1构成的字符串,表示一个病毒特征代码所有的病毒的特征代码总长度不超过30000输出如 阅读全文
posted @ 2018-10-29 23:24 TobicYAL 阅读(1164) 评论(0) 推荐(0) 编辑
摘要: 描述 Aliens on planet Pandora also write computer programs like us. Their programs only consist of capital letters (‘A’ to ‘Z’) which they learned from 阅读全文
posted @ 2018-10-29 23:18 TobicYAL 阅读(753) 评论(0) 推荐(0) 编辑
摘要: 描述 给若干个模式串,以及若干个句子,判断每个句子里是否包含模式串。 句子和模式串都由小写字母组成 输入第一行是整数n,表示有n个模式串 ( n <= 1000)接下来n行每行一个模式串。每个模式串长度不超过20接下来一行是整数m,表示有m个句子 (m <= 1000)接下来m行,每行一个句子,每个 阅读全文
posted @ 2018-10-29 23:15 TobicYAL 阅读(702) 评论(0) 推荐(0) 编辑
摘要: 描述 A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. 阅读全文
posted @ 2018-10-22 20:19 TobicYAL 阅读(314) 评论(1) 推荐(0) 编辑
摘要: 描述 You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were asked to write a 阅读全文
posted @ 2018-10-22 20:10 TobicYAL 阅读(279) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页