自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(29)
  • 收藏
  • 关注

原创 06-图2 Saving James Bond - Easy Version (25分)

06-图2 Saving James Bond - Easy Version   (25分)This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group

2016-04-17 11:24:22 1078

原创 06-图1 列出连通集 (25分)

06-图1 列出连通集   (25分)给定一个有NN个顶点和EE条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N1N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。输入格式:输入第1行给出2个整数NN(0N100N≤10)和EE,分别是图的顶点数和边数。随后EE行,每行给出一条边的两个端点。每行中的数字之间

2016-04-17 11:16:08 1324

原创 05-树9 Huffman Codes (30分)

05-树9 Huffman Codes   (30分)In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Codes", and hence printed his name in the history of computer scie

2016-04-02 15:27:36 4580

原创 05-树8 File Transfer (25分)

05-树8 File Transfer   (25分)We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possibl

2016-04-02 15:16:51 3417

原创 05-树7 堆中的路径 (25分)

05-树7 堆中的路径   (25分)将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。输入格式:每组测试第1行包含2个正整数NN和MM(1000≤1000),分别是插入元素的个数、以及需要打印的路径条数。下一行给出区间[-10000, 10000]内的NN个要被插入一个初始为空的小顶堆的整数。最后一行给出MM

2016-04-02 15:06:59 2553

原创 04-树6 Complete Binary Search Tree (30分)

04-树6 Complete Binary Search Tree   (30分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only

2016-03-28 21:32:45 613

原创 04-树5 Root of AVL Tree (25分)

04-树5 Root of AVL Tree   (25分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they d

2016-03-28 18:41:31 566

原创 04-树4 是否同一棵二叉搜索树 (25分)

04-树4 是否同一棵二叉搜索树   (25分)给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输入的各种插入序列,你需要判断它们是否能生成一样的二叉搜索树。输入格式:输入包含若干组测试数据。每组数据的第1

2016-03-28 12:58:34 3953

原创 03-树3 Tree Traversals Again (25分)

03-树3 Tree Traversals Again   (25分)An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys n

2016-03-27 11:42:28 662

原创 03-树2 List Leaves (25分)

03-树2 List Leaves   (25分)Given a tree, you are supposed to list all the leaves in the order of top down, and left to right.Input Specification:Each input file contains one test case. F

2016-03-27 11:27:47 442

原创 03-树1 树的同构 (25分)

03-树1 树的同构   (25分)给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。图1图2现给定两棵树,请你判断它们是否是同构的。输入格式

2016-03-26 23:17:03 6016

原创 02-线性结构3 Pop Sequence (25分)

02-线性结构3 Pop Sequence   (25分)Given a stack which can keep MM numbers at most. Push NN numbers in the order of 1, 2, 3, ..., NN and pop randomly. You are supposed to tell if a given seque

2016-03-26 23:03:47 482

原创 02-线性结构2 Reversing Linked List (25分)

02-线性结构2 Reversing Linked List   (25分)Given a constant KK and a singly linked list LL, you are supposed to reverse the links of every KK elements on LL. For example, given LL being 1

2016-03-26 17:09:04 3664

原创 02-线性结构1 一元多项式的乘法与加法运算 (20分)

02-线性结构1 一元多项式的乘法与加法运算   (20分)设计函数分别求两个一元多项式的乘积与和。输入格式:输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空

2016-03-26 16:51:46 2095

原创 01-复杂度2 Maximum Subsequence Sum (25分)

01-复杂度2 Maximum Subsequence Sum   (25分)Given a sequence of KK integers { N1N​1​​, N2N​2​​, ..., NKN​K​​ }. A continuous subsequence is defined to be { NiN​i​​, Ni1N​i+1​​, ..., NjN​j​​

2016-03-26 16:47:37 5281 1

原创 01-复杂度1 最大子列和问题 (20分)

01-复杂度1 最大子列和问题   (20分)给定KK个整数组成的序列{ N1N​1​​, N2N​2​​, ..., NKN​K​​ },“连续子列”被定义为{ NiN​i​​, Ni1N​i+1​​, ..., NjN​j​​ },其中 1ijK1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5

2016-03-26 16:37:47 4802

原创 1013. Battle Over Cities (25)

1013. Battle Over Cities (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueIt is vitally important to have all the

2016-03-04 19:40:03 362

原创 1012. The Best Rank (25)

1012. The Best Rank (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueTo evaluate the performance of our first yea

2016-03-04 14:34:05 401

原创 1010. Radix (25)

时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a pair of positive integers, for example, 6 and 110, can this equation

2016-03-04 09:40:20 317

原创 1007. Maximum Subsequence Sum (25)

Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 Maximum Subsequence is the continuous subsequence which has the largest su

2016-02-20 22:34:48 377

原创 1006. Sign In and Sign Out (25)

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you

2016-02-20 22:32:27 351

原创 1005. Spell It Right (20)

Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case.

2016-02-19 21:57:50 295

原创 1004. Counting Leaves (30)

1004. Counting Leaves (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA family hierarchy is usually presented by a

2016-02-02 14:18:23 337

原创 1001. A+B Format (20)

Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input file cont

2015-12-27 18:55:13 297

原创 08-图8 How Long Does It Take

Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the project.Input Specification:Each input file contains one test case. Each ca

2015-11-29 14:02:10 464

原创 08-图7 公路村村通

现有村落间道路的统计数据表中,列出了有可能建设成标准公路的若干条道路的成本,求使每个村落都有公路连通所需要的最低成本。输入格式:输入数据包括城镇数目正整数N(≤1000)和候选道路数目M(≤3N);随后的M行对应M条道路,每行给出3个正整数,分别是该条道路直接连通的两个城镇的编号以及该道路改建的预算成本。为简单起见,城镇从1到N编号。输出格式:输出村村通需要的最低成

2015-11-29 14:01:12 1562

原创 07-图6 旅游规划

有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。输入格式:输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M是高速公路的条数;S是出发地

2015-11-29 14:00:23 1283

原创 07-图5 Saving James Bond - Hard Version

This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land

2015-11-29 13:59:20 387

原创 06-图3 六度空间

“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示。图1 六度空间示意图“六度空间”理论虽然得到广泛的认同,并且正在得到越来越多的应用。但是数十年来,试图验证这个理论始终是许多社会学家努力追求的目标

2015-11-29 13:57:02 1503

空空如也

空空如也

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

TA关注的人

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