2020年12月24日
摘要: 洛谷P1255、P2437. 思路相同,注意何时进位以及数组最大长度! #include <stdio.h> short dp[5020][2000] = { 0 }; void f(int n) { dp[0][0] = 0; dp[1][0] = 1; dp[2][0] = 2; int fla 阅读全文
posted @ 2020-12-24 16:13 porest 阅读(88) 评论(0) 推荐(0) 编辑
  2020年12月18日
摘要: 一. 利用字符串的一维数组方法逐位运算: 高精度加法: 思路很简单,通过数组储存每一位数,然后相加进位。 #include <stdio.h> #include <string.h> int main() { char a[510] = { 0 }, b[510] = { 0 }; int a1[5 阅读全文
posted @ 2020-12-18 23:00 porest 阅读(100) 评论(0) 推荐(0) 编辑
  2020年12月16日
摘要: 非空树只有一个根,树的各节点互不相交。 degree == 0, 为 leaf. child, parent, sibling. 各子树不能交换,称之为有序树,否则为无序树。 小结: 根节点:唯一,无双亲。 叶节点:无孩子,可以多个。 中间节点:一个双亲,多个孩子。 双亲表示法: typedef i 阅读全文
posted @ 2020-12-16 09:29 porest 阅读(676) 评论(0) 推荐(0) 编辑
  2020年12月15日
摘要: 串的模式匹配算法: 即字串的定位问题 1.蛮力法:大循环嵌套小循环。 2.KPM模式匹配算法。 阅读全文
posted @ 2020-12-15 19:24 porest 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 一端插入一端删除的线性表,FIFO。 循环队列: 为保证队列不出现伪溢出,一般将其构造为循环队列。 为方便判断队列是否已满,将队列满定义为还剩一个数组空间。 队列满的条件:(rear+1)%QueueSize == front (rear队尾, front队头) 队列长度计算公式:(rear-fro 阅读全文
posted @ 2020-12-15 19:14 porest 阅读(381) 评论(0) 推荐(0) 编辑
摘要: 栈: Last in First out 线性表,故又称作LIFO结构。 顺序存储:空栈设栈顶指针为-1;否则为数组下标。 #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #pragma warning (disable:499 阅读全文
posted @ 2020-12-15 15:25 porest 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 本次作业使用easyX图形库。 version 1.0.1 (an ugly one) 基本实现消消乐的下落,消除的功能。 下个版本需改进的:1. 防止下落过程中消除。 2. 导入游戏初始菜单,尽量实现菜单中的各种功能。 3.显示得分。 #include <stdio.h> #include <gr 阅读全文
posted @ 2020-12-15 14:23 porest 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 静态链表: 由数组描述,每个元素由两个数据域组成。 为没有指针的语言设计,但应该尽量理解。 各种链表。 顺序存储结构。 阅读全文
posted @ 2020-12-15 10:05 porest 阅读(46) 评论(0) 推荐(0) 编辑
  2020年12月8日
摘要: 相较数组而言,具有更好的空间效率。 单链表的各种操作: 有序单链表的插入一定要考虑清楚多种情况。 #include <stdio.h> #include <stdlib.h> #pragma warning (disable:4996) typedef struct link{ ///build a 阅读全文
posted @ 2020-12-08 19:32 porest 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 动态分配复制字符串: #include <stdio.h> #include <stdlib.h> #include <string.h> #pragma warning (disable:4996) char* strdup(char const* string) { char* new_stri 阅读全文
posted @ 2020-12-08 18:54 porest 阅读(87) 评论(0) 推荐(0) 编辑