- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 数据结构练习 02-线性结构4 Pop Sequence (25 分)
Given a stack which can keepMnumbers at most. PushNnumbers in the order of 1, 2, 3, ...,Nand pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of t...
2019-10-26 20:25:19 495
原创 数据结构练习 02-线性结构3 Reversing Linked List (25 分)
Given a constantKand a singly linked listL, you are supposed to reverse the links of everyKelements onL. For example, givenLbeing 1→2→3→4→5→6, ifK=3, then you must output 3→2→1→6→5→4; ifK=4,...
2019-10-26 20:08:27 474
原创 数据结构练习 02-线性结构2 一元多项式的乘法与加法运算 (20 分)
设计函数分别求两个一元多项式的乘积与和。输入格式:输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。零多项式应输出0 0。输入样例:4 3 4 -5 2...
2019-10-16 16:34:46 336
原创 数据结构练习 02-线性结构1 两个有序链表序列的合并 (15 分)
本题要求实现一个函数,将两个链表表示的递增整数序列合并为一个非递减的整数序列。函数接口定义:List Merge( List L1, List L2 );其中List结构定义如下:typedef struct Node *PtrToNode;struct Node { ElementType Data; /* 存储结点数据 */ PtrToNode Ne...
2019-10-14 22:17:44 373
原创 数据结构练习 01-复杂度3 二分查找 (20 分)
本题要求实现二分查找算法。函数接口定义:Position BinarySearch( List L, ElementType X );其中List结构定义如下:typedef int Position;typedef struct LNode *List;struct LNode { ElementType Data[MAXSIZE]; Position ...
2019-10-14 21:30:40 255
原创 数据结构练习 01-复杂度2 Maximum Subsequence Sum (25 分)
Given a sequence ofKintegers {N1,N2, ...,NK}. A continuous subsequence is defined to be {Ni,Ni+1, ...,Nj} where1≤i≤j≤K. The Maximum Subsequence is the continuous subsequen...
2019-10-14 21:19:08 322
原创 数据结构课后练习 01-复杂度1 最大子列和问题 (20 分)
给定K个整数组成的序列{N1,N2, ...,NK},“连续子列”被定义为{Ni,Ni+1, ...,Nj},其中1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5, -2 },其连续子列{ 11, -4, 13 }有最大的和20。现要求你编写程序,计算给定整数序列的最大子...
2019-10-14 20:55:25 443
原创 Codeforces——Hello 2019(待更新)
A. Gennady and a Card GameGennady owns a small hotel in the countryside where he lives a peaceful life. He loves to take long walks, watch sunsets and play cards with tourists staying in his hotel. ...
2019-01-05 09:27:15 1263
原创 Educational Codeforces Round 57 (Rated for Div. 2) (待更新)
A.Find DivisibleYou are given a range of positive integers from l to r .Find such a pair of integers (x,y) that l≤x,y≤r , x≠y and x divides y .If there are multiple answers, print any of them....
2018-12-29 13:54:35 376
原创 最短路Dijkstra变形——Frogger
Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists' sun...
2018-12-25 17:46:23 200
原创 最短路Dijkstra——Til the Cows Come Home
Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get b...
2018-12-24 23:32:32 162
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人