
刷题题解
藕丝炖刺猬
做该做的事才会开心吧
展开
-
03-树2 List Leaves
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. For each case, the first line gives a positive integerN(≤10) which is the total number of no..原创 2020-07-28 11:15:44 · 146 阅读 · 0 评论 -
02-线性结构4 Pop Sequence
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 the stack. For example, ifMis 5 andNis 7, we can o...原创 2020-07-21 18:23:53 · 356 阅读 · 0 评论 -
线性结构2 一元多项式的乘法与加法运算
设计函数分别求两个一元多项式的乘积与和。输入格式:输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。零多项式应输出0 0。输入样例:4 3 4 -5 2 6 1 -2 03 5 20 -7 4 3 1输出样例:15 24 -25 ...原创 2020-07-19 16:35:16 · 200 阅读 · 0 评论 -
02-线性结构1 两个有序链表序列的合并
本题要求实现一个函数,将两个链表表示的递增整数序列合并为一个非递减的整数序列。函数接口定义:List Merge( List L1, List L2 );其中List结构定义如下:typedef struct Node *PtrToNode;struct Node { ElementType Data; /* 存储结点数据 */ PtrToNode Next; /* 指向下一个结点的指针 */};typedef PtrToNode List; /* 定义单链表原创 2020-07-09 11:11:22 · 172 阅读 · 0 评论 -
01-复杂度2 Maximum Subsequence Sum (25分)
01-复杂度2Maximum 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 subsequence which has the ...原创 2020-07-02 17:20:08 · 284 阅读 · 0 评论 -
数据结构-起步能力自测题Have Fun with Numbers
自测-4Have Fun with Numbers(20分)Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the...原创 2020-06-30 16:49:38 · 452 阅读 · 0 评论 -
百练2503在线翻译题解
2503:Babelfish总时间限制:3000ms内存限制:65536kB描述You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have...原创 2020-02-06 16:22:51 · 759 阅读 · 0 评论 -
百练P1664放苹果题解
1664:放苹果总时间限制:1000ms内存限制:65536kB描述把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。输入第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。输出...原创 2020-01-12 16:53:05 · 288 阅读 · 0 评论 -
洛谷P1200 [USACO1.1]你的飞碟在这儿Your Ride Is He…
题目描述众所周知,在每一个彗星后都有一只UFO。这些UFO时常来收集地球上的忠诚支持者。不幸的是,他们的飞碟每次出行都只能带上一组支持者。因此,他们要用一种聪明的方案让这些小组提前知道谁会被彗星带走。他们为每个彗星起了一个名字,通过这些名字来决定这个小组是不是被带走的那个特定的小组(你认为是谁给这些彗星取的名字呢?)。关于如何搭配的细节会在下面告诉你;你的任务是写一个程序,通过小组名和彗星名来...原创 2019-07-04 10:08:43 · 401 阅读 · 0 评论 -
洛谷P1055 ISBN号码题解
这道题算是比较直白简单,但依旧没有一次ac,伴随着n年的审题问题和躁动的心态。本题值得注意的还有字符与整形的几次转化,可以注意一下转化的格式! 我们如果对c语言里数据是如何存储的不清楚的话,就会导致我们对程序的理解越来越困难。说白了c语言就是人与机器交流的一种规则,而机器和芯片能明白的只能是0和1这两种高低电平。他们什么也不懂。只是一堆模拟电子和数字电路板集合。那人们怎么会操作这些破...原创 2019-07-02 18:24:13 · 992 阅读 · 1 评论