Homework 3: Higher-Order Functions, Self Reference, Recursion, Tree Recursion

Q1: Compose

编写一个高阶函数composer,它返回两个函数funcfunc_adder。 func是一个单参数函数,它应用到目前为止已经组合的所有函数。这些函数将首先应用最新的函数(参见doctests和示例)。 func_adder用于向我们的组合添加更多函数,当调用另一个函数g时,func_adder应该返回一个新的func和一个新的func_adder

如果没有参数传入composer,则返回的func是恒等函数。

举例来说:

>>> add_one = lambda x: x + 1
>>> square = lambda x: x * x
>>> times_two = lambda x: x + x>>> f1, func_adder = composer()
>>> f1(1)
1>>> f2, func_adder = func_adder(add_one)
>>> f2(1)
2   # 1 + 1>>> f3, func_adder = func_adder(square)
>>> f3(3)
10  # 1 + (3**2)>>> f4, func_adder = func_adder(times_two)
>>> f4(3)
37  # 1 + ((2 * 3) **2)

提示:你的func_adder应该返回两个参数func和 func_adder.

我们知道什么函数返回funcfunc_adder

(这个提示真的神来之笔:由于compose返回

func

func_adder这两个函数

所以func_adder应该是以新func为形参的compose函数

(func    =         lambda x:func(g(x))       

g(x)作为原函数的参数x        逐级嵌套 )如图:

def composer(func=lambda x: x):"""Returns two functions -one holding the composed function so far, and anotherthat can create further composed problems.>>> add_one = lambda x: x + 1>>> mul_two = lambda x: x * 2>>> f, func_adder = composer()>>> f1, func_adder = func_adder(add_one)>>> f1(3)4>>> f2, func_adder = func_adder(mul_two)>>> f2(3) # should be 1 + (2*3) = 77>>> f3, func_adder = func_adder(add_one)>>> f3(3) # should be 1 + (2 * (3 + 1)) = 99"""def func_adder(g):"*** YOUR CODE HERE ***"return  composer(lambda x:func(g(x)))return func, func_adder

pass:

PS D:\pycharm\python document\CS61A class homework\hw03> python3 ok -q composer
=====================================================================
Assignment: Homework 3
OK, version v1.18.1
=====================================================================~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests---------------------------------------------------------------------
Test summary1 test cases passed! No cases failed.

Q4: Count change

Once the machines take over, the denomination of every coin will be a power of two: 1-cent, 2-cent, 4-cent, 8-cent, 16-cent, etc. There will be no limit to how much a coin can be worth.

Given a positive integer total, a set of coins makes change for total if the sum of the values of the coins is total. For example, the following sets make change for 7:

  • 7 1-cent coins
  • 5 1-cent, 1 2-cent coins
  • 3 1-cent, 2 2-cent coins
  • 3 1-cent, 1 4-cent coins
  • 1 1-cent, 3 2-cent coins
  • 1 1-cent, 1 2-cent, 1 4-cent coins

Thus, there are 6 ways to make change for 7. Write a recursive function count_change that takes a positive integer total and returns the number of ways to make change for total using these coins of the future.

Hint: Refer the implementation of count_partitions for an example of how to count the ways to sum up to a total with smaller parts. If you need to keep track of more than one value across recursive calls, consider writing a helper function.

分析:作者把此题核心分为两个函数

divide函数:

作用:

求 对于total 满足1------小于total的最大2的倍数 面值美分  的排列种类

核心:

将一种情况分为两种情况即:

当前有最大数的排列数量        和        无当前最大数的数量

举个例子如图(函数实现过程):

max1:

求的是 小于total的最大2的倍数

def divide(total,num):if num==1:return 1if total<num:return divide(total,num/2)return divide(total-num,num)+divide(total,num/2)def max1(total):if total<=1:return 1if total>0:return max1(total//2)*2
def count_change(total):"""Return the number of ways to make change for total.>>> count_change(7)6>>> count_change(10)14>>> count_change(20)60>>> count_change(100)9828>>> from construct_check import check>>> # ban iteration>>> check(HW_SOURCE_FILE, 'count_change', ['While', 'For'])True""""*** YOUR CODE HERE ***"if total==1:return 1return divide(total,max1(total))

pass结果:

PS D:\pycharm\python document\CS61A class homework\hw03> python3 ok -q count_change
=====================================================================
Assignment: Homework 3
OK, version v1.18.1
=====================================================================~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests---------------------------------------------------------------------
Test summary1 test cases passed! No cases failed.

Q5: Towers of Hanoi

一个经典的难题称为塔的河内是一个游戏,包括三个 杆和许多不同尺寸的圆盘,圆盘可以在任何杆上滑动。 这个谜题从n磁盘开始,磁盘按照大小的升序整齐地堆叠在一起, start棒,顶部最小,形成圆锥形。

拼图的目的是将整个堆叠移动到end杆, 遵守以下规则:

  • 一次只能移动一个磁盘。
  • 每次移动包括从其中一根杆上取下顶部(最小)的圆盘, 把它滑到另一个杆上,在其他可能已经被 存在于该杆上。
  • 不能将磁盘放在较小磁盘的顶部。

完成move_stack的定义,它将打印出执行以下操作所需的步骤: 将n盘从start棒移动到end棒,不违反 规则提供的print_move函数将打印出移动 从给定的origin到给定的destination的单个磁盘。

提示:在一张纸上画出几个带有各种n的游戏,并尝试 找到一个适用于任何n的磁盘运动模式。在你的解决方案中, 当你需要移动任何数量的 小于n的圆盘从一个棒到另一个棒。如果你需要更多帮助, 以下提示。

 分析:

核心:拆分思想(动态规划dp)

对于n个盘子需要从起点到终点的问题可以转化为

1.将n个盘子需要从起点到非起点或终点,

2.第n个盘子从起点到终点

3.再将n-1盘子放到终点的过程

(1)其中对于n==2的情况(即递归终点)需要模拟出相应过程

注意:n==1需要额外说明

如图所示:

def print_move(origin, destination):"""Print instructions to move a disk."""print("Move the top disk from rod", origin, "to rod", destination)def move_stack(n, start, end):"""Print the moves required to move n disks on the start pole to the endpole without violating the rules of Towers of Hanoi.n -- number of disksstart -- a pole position, either 1, 2, or 3end -- a pole position, either 1, 2, or 3There are exactly three poles, and start and end must be different. Assumethat the start pole has at least n disks of increasing size, and the endpole is either empty or has a top disk larger than the top n start disks.>>> move_stack(1, 1, 3)Move the top disk from rod 1 to rod 3>>> move_stack(2, 1, 3)Move the top disk from rod 1 to rod 2Move the top disk from rod 1 to rod 3Move the top disk from rod 2 to rod 3>>> move_stack(3, 1, 3)Move the top disk from rod 1 to rod 3Move the top disk from rod 1 to rod 2Move the top disk from rod 3 to rod 2Move the top disk from rod 1 to rod 3Move the top disk from rod 2 to rod 1Move the top disk from rod 2 to rod 3Move the top disk from rod 1 to rod 3"""assert 1 <= start <= 3 and 1 <= end <= 3 and start != end, "Bad start/end""*** YOUR CODE HERE ***"n_s=0if 1!=start and 1!=end:n_s=1if 2!=start and 2!=end:n_s=2if 3!=start and 3!=end:n_s=3if n==1:print_move(start,end)returnif n==2:print_move(start,n_s)print_move(start,end)print_move(n_s,end)returnmove_stack(n-1,start,n_s)print_move(start,end)move_stack(n-1,n_s,end)

pass情况:

PS D:\pycharm\python document\CS61A class homework\hw03> python3 ok -q move_stack
=====================================================================
Assignment: Homework 3
OK, version v1.18.1
=====================================================================~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests---------------------------------------------------------------------
Test summary1 test cases passed! No cases failed.

Q6: Anonymous factorial

The recursive factorial function can be written as a single expression by using a conditional expression.

>>> fact = lambda n: 1 if n == 1 else mul(n, fact(sub(n, 1)))
>>> fact(5)
120

However, this implementation relies on the fact (no pun intended) that fact has a name, to which we refer in the body of fact. To write a recursive function, we have always given it a name using a def or assignment statement so that we can refer to the function within its own body. In this question, your job is to define fact recursively without giving it a name!

Write an expression that computes n factorial using only call expressions, conditional expressions, and lambda expressions (no assignment or def statements). Note in particular that you are not allowed to use make_anonymous_factorial in your return expression. The sub and mul functions from the operator module are the only built-in functions required to solve this problem:

from operator import sub, muldef make_anonymous_factorial():"""Return the value of an expression that computes factorial.>>> make_anonymous_factorial()(5)120>>> from construct_check import check>>> # ban any assignments or recursion>>> check(HW_SOURCE_FILE, 'make_anonymous_factorial', ['Assign', 'AugAssign', 'FunctionDef', 'Recursion'])True"""return lambda n : (lambda x, function : 1 if x == 1 else x * function(x - 1, function))(n, lambda x, function : 1 if x == 1 else x * function(x - 1, function))

分析:

 from operator import sub, mul​def make_anonymous_factorial():def function(x, function):if(x == 1):return 1else:return function(x - 1, function) * xreturn lambda n : function(n, function)

 我采取了High-order Function的方法,

定义一个将自身作为参数的函数

从更深层次的角度来讲,

这不过是将“函数”的Abstraction程度降低了一层,将 “函数寻址”这一行为显式地实现了

function()用lambda表达出来即:

lambda x, function : 1 if x == 1 else x * function(x - 1, function)

合并即以下答案:

1.lambda x:

函数体:

( lambda x,function:function(x-1,function)*x if x>0 else 1)

参数:

(x,lambda x,function:function(x-1,function)*x if x>0 else 1)

另外一种形式:

2.

lambda x:

函数体:

(lambda x,function:function(x-1,function)*x if x>0 else 1)

参数:

(x-1,lambda x,function:function(x-1,function)*x if x>0 else 1)

*x if x>0 else 1

错误分析

function(未给出定义)

 1.error:

(lambda x,function:function(x-1,function)*x if x>0 else 1)

(x-1,function)*x if x>0 else 1

2.error:

(lambda x,function:function(x-1,function)*x if x>0 else 1)

(x,function)

pass情况:

PS D:\pycharm\python document\CS61A class homework\hw03> python3 ok -q make_anonymous_factorial
=====================================================================
Assignment: Homework 3
OK, version v1.18.1
=====================================================================~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests---------------------------------------------------------------------
Test summary1 test cases passed! No cases failed.Backup... 100% complete
Backup past deadline by 1245 days, 3 hours, 43 minutes, and 25 secondsOK is up to date

 完整答案:

HW_SOURCE_FILE=__file__def composer(func=lambda x: x):"""Returns two functions -one holding the composed function so far, and anotherthat can create further composed problems.>>> add_one = lambda x: x + 1>>> mul_two = lambda x: x * 2>>> f, func_adder = composer()>>> f1, func_adder = func_adder(add_one)>>> f1(3)4>>> f2, func_adder = func_adder(mul_two)>>> f2(3) # should be 1 + (2*3) = 77>>> f3, func_adder = func_adder(add_one)>>> f3(3) # should be 1 + (2 * (3 + 1)) = 99"""def func_adder(g):"*** YOUR CODE HERE ***"return  composer(lambda x:func(g(x)))return func, func_adderdef g(n):"""Return the value of G(n), computed recursively.>>> g(1)1>>> g(2)2>>> g(3)3>>> g(4)10>>> g(5)22>>> from construct_check import check>>> # ban iteration>>> check(HW_SOURCE_FILE, 'g', ['While', 'For'])True""""*** YOUR CODE HERE ***"if n<=3:return nelse:return g(n-1)+2*g(n-2)+3*g(n-3)def g_iter(n):"""Return the value of G(n), computed iteratively.>>> g_iter(1)1>>> g_iter(2)2>>> g_iter(3)3>>> g_iter(4)10>>> g_iter(5)22>>> from construct_check import check>>> # ban recursion>>> check(HW_SOURCE_FILE, 'g_iter', ['Recursion'])True""""*** YOUR CODE HERE ***"if n<=3:return nelse:f1=1f2=2f3=3f4=3*f1+2*f2+f3while n>4:f1=f2f2=f3f3=f4f4=3*f1+2*f2+f3n-=1return f4def missing_digits(n):"""Given a number a that is in sorted, increasing order,return the number of missing digits in n. A missing digit isa number between the first and last digit of a that is not in n.>>> missing_digits(1248) # 3, 5, 6, 74>>> missing_digits(1122) # No missing numbers0>>> missing_digits(123456) # No missing numbers0>>> missing_digits(3558) # 4, 6, 73>>> missing_digits(35578) # 4, 62>>> missing_digits(12456) # 31>>> missing_digits(16789) # 2, 3, 4, 54>>> missing_digits(19) # 2, 3, 4, 5, 6, 7, 87>>> missing_digits(4) # No missing numbers between 4 and 40>>> from construct_check import check>>> # ban while or for loops>>> check(HW_SOURCE_FILE, 'missing_digits', ['While', 'For'])True""""*** YOUR CODE HERE ***"if n//10==0:return 0last=n%10n=n//10if n%10<last:dec=last-1-n%10else:dec=0return missing_digits(n)+decdef divide(total,num):if num==1:return 1if total<num:return divide(total,num/2)return divide(total-num,num)+divide(total,num/2)def max1(total):if total<=1:return 1if total>0:return max1(total//2)*2
def count_change(total):"""Return the number of ways to make change for total.>>> count_change(7)6>>> count_change(10)14>>> count_change(20)60>>> count_change(100)9828>>> from construct_check import check>>> # ban iteration>>> check(HW_SOURCE_FILE, 'count_change', ['While', 'For'])True""""*** YOUR CODE HERE ***"if total==1:return 1return divide(total,max1(total))def print_move(origin, destination):"""Print instructions to move a disk."""print("Move the top disk from rod", origin, "to rod", destination)def move_stack(n, start, end):"""Print the moves required to move n disks on the start pole to the endpole without violating the rules of Towers of Hanoi.n -- number of disksstart -- a pole position, either 1, 2, or 3end -- a pole position, either 1, 2, or 3There are exactly three poles, and start and end must be different. Assumethat the start pole has at least n disks of increasing size, and the endpole is either empty or has a top disk larger than the top n start disks.>>> move_stack(1, 1, 3)Move the top disk from rod 1 to rod 3>>> move_stack(2, 1, 3)Move the top disk from rod 1 to rod 2Move the top disk from rod 1 to rod 3Move the top disk from rod 2 to rod 3>>> move_stack(3, 1, 3)Move the top disk from rod 1 to rod 3Move the top disk from rod 1 to rod 2Move the top disk from rod 3 to rod 2Move the top disk from rod 1 to rod 3Move the top disk from rod 2 to rod 1Move the top disk from rod 2 to rod 3Move the top disk from rod 1 to rod 3"""assert 1 <= start <= 3 and 1 <= end <= 3 and start != end, "Bad start/end""*** YOUR CODE HERE ***"n_s=0if 1!=start and 1!=end:n_s=1if 2!=start and 2!=end:n_s=2if 3!=start and 3!=end:n_s=3if n==1:print_move(start,end)returnif n==2:print_move(start,n_s)print_move(start,end)print_move(n_s,end)returnmove_stack(n-1,start,n_s)print_move(start,end)move_stack(n-1,n_s,end)from operator import sub, muldef make_anonymous_factorial():"""Return the value of an expression that computes factorial.>>> make_anonymous_factorial()(5)120>>> from construct_check import check>>> # ban any assignments or recursion>>> check(HW_SOURCE_FILE, 'make_anonymous_factorial', ['Assign', 'AugAssign', 'FunctionDef', 'Recursion'])True"""return lambda x:(lambda x,function:function(x-1,function)*x if x>0 else 1)(x-1,lambda x,function:function(x-1,function)*x if x>0 else 1)*x if x>0 else 1

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/200885.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

“快慢指针”思想在物理或者逻辑循环中的应用

1 基础概念 1.1 什么是物理循环和逻辑循环&#xff1f; 物理循环是指物理索引访问顺序上相邻&#xff0c;逻辑上也相邻&#xff0c;比如循环链表&#xff0c;逻辑循环则指物理的索引上不一定相邻 1.2 快慢指针本质上可以解决逻辑循环问题&#xff0c;而物理循环也属于逻辑循…

用AI在抖音直播做姓氏头像的全新玩法,详细分析制作教程

前段时间在圈子里给大家分享了用AI写艺术字做小红书账号案例玩法&#xff0c;同学们都比较热衷学习。纷纷动手实践。 事实上用AI艺术字变现玩法还有许多。 例如上周末在星球给圈友们分享的一个AI艺术字直播的抖音账号&#xff0c;直播内容形式很简单&#xff0c;就是展现用AI…

七大经典高效学习方法

金字塔学习模型 金字塔学习是美国学习专家爱德加戴尔1946年提出的。 他将学习分为主动学习和被动学习两种类型&#xff0c;用数字形象地呈现了采用不同学习方式&#xff0c;学习者在两周后还能记住的内容有多少。 被动学习&#xff1a;通过听讲、阅读、视听、演示这些活动&a…

Java网络编程——基础入门

1、进程间的通信 进程指运行中的程序&#xff0c;进程的任务就是执行程序中的代码。EchoPlayer类是一个独立的Java程序&#xff0c;它可以在任意一台安装了JDK的主机上运行&#xff1a; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStr…

Linux socket编程(11):Unix套接字编程及通信例子

Unix套接字是一种用于在同一台计算机上的进程间通信的一种机制。它是Linux和其他类Unix系统中的一项特性&#xff0c;通过在文件系统中创建特殊的套接字文件&#xff0c;进程可以通过这些套接字文件进行通信。 文章目录 1 Unix和TCP套接字对比2 Unix套接字初始化流程3 例:服务端…

3.4 路由器的DHCP配置

实验3.4 路由器的DHCP配置 一、任务描述二、任务分析三、具体要求四、实验拓扑五、任务实施&#xff08;一&#xff09;配置基于接口地址池的DHCP1.交换机的基本配置2.路由器的基本配置3.开启路由器的DHCP服务器功能4.配置路由器接口的DHCP功能5.设置计算机使用DHCP方式获取IP地…

DS图应用--最短路径

Description 给出一个图的邻接矩阵&#xff0c;再给出指定顶点v0&#xff0c;求顶点v0到其他顶点的最短路径 Input 第一行输入t&#xff0c;表示有t个测试实例 第二行输入n&#xff0c;表示第1个图有n个结点 第三行起&#xff0c;每行输入邻接矩阵的一行&#xff0c;以此类…

Hello World!

一、minist数据集 深度学习编程特有的hello world程序&#xff1a;采用minist数据集完成意向特定深度学习项目 1、minist数据集介绍 MNIST数据集是一个广泛使用的手写数字识别数据集&#xff0c;它包含了许多不同人手写的数字图片。这个数据集被广泛用于研究手写数字识别&…

通过keepalived+nginx实现 k8s apiserver节点高可用

一、环境准备 K8s 主机配置&#xff1a; 配置&#xff1a; 4Gib 内存/4vCPU/60G 硬盘 网络&#xff1a;机器相互可以通信 k8s 实验环境网络规划&#xff1a; podSubnet&#xff08;pod 网段&#xff09; 10.244.0.0/16 serviceSubnet&#xff08;service 网段&#xff09;: 1…

【S32K3环境搭建】-0.2-安装S32DS product updates和 packages

目录 1 安装S32DS product updates和 packages 1.1 方法一&#xff1a;通过S32DS Extensions and Updates安装product updates和 packages 1.2 方法二&#xff1a;通过Install New Software…安装product updates和 packages 2 S32DS product updates和 packages安装后的效…

海外服务器和国内服务器有什么样的区别呢

海外服务器和国内服务器有什么样的区别呢&#xff0c;其实呢在外形方面是大同小异&#xff0c;除了外形还有一些其他方面还存在这一些差异。 一&#xff0c;地理位置的差异。 海外服务器——有可能在中国数据中心之外的任何国家地区&#xff0c;例如美国服务器&#xff0c;韩…

视频汇聚/音视频流媒体视频平台/视频监控EasyCVR分享页面无法播放,该如何解决?

国标GB28181安防视频监控/视频集中存储/云存储EasyCVR平台可拓展性强、视频能力灵活、部署轻快&#xff0c;可支持的主流标准协议有国标GB28181、RTSP/Onvif、RTMP等&#xff0c;以及支持厂家私有协议与SDK接入&#xff0c;包括海康Ehome、海大宇等设备的SDK等。平台既具备传统…

PRCD-1229 : An attempt to access configuration of database

今天维护oda一体机时&#xff0c;发现无法在grid用户下面关闭数据库实例&#xff0c;如下 ASM1:/home/gridoda0>srvctl stop database -d orcl -o immeidate PRCD-1229 : An attempt to access configuration of database orcl was rejected because its version 11.2.0.4.…

dockerdesktop推送镜像到dockerhub

1.查看镜像(打开powershell) docker ps2.打tag docker tag pengzx/aspnetcoredocker:v1 pengzx/aspnetcoredocker:v2pengzx/aspnetcoredocker:v1:本地的镜像名加版本号 pengzx/aspnetcoredocker:v2&#xff1a;需要上传的镜像名&#xff08;要以dockerhub的用户名开头/本地镜像…

软著项目推荐 深度学习的智能中文对话问答机器人

文章目录 0 简介1 项目架构2 项目的主要过程2.1 数据清洗、预处理2.2 分桶2.3 训练 3 项目的整体结构4 重要的API4.1 LSTM cells部分&#xff1a;4.2 损失函数&#xff1a;4.3 搭建seq2seq框架&#xff1a;4.4 测试部分&#xff1a;4.5 评价NLP测试效果&#xff1a;4.6 梯度截断…

【工作生活】汽车电子嵌入式开发简介

目录 1. 目标 2. 要分享什么 3.1 行业知识 3.1.1车载行业知识&#xff1a; 3.1.2项目&#xff1a; 3.1.3开发测试工具&#xff1a; 3.2 硬件平台 3.3 基础知识 3.4 工作生活 3. 我们是谁 1. 目标 随着新能源汽车的快速崛起&#xff0c;汽车电子行业开始快速发展&…

掌控安全 暖冬杯 CTF Writeup By AheadSec

本来结束时发到了学校AheadSec的群里面了的&#xff0c;觉得这比赛没啥好外发WP的&#xff0c;但是有些师傅来问了&#xff0c;所以还是发一下吧。 文章目录 Web签到&#xff1a;又一个计算题计算器PHP反序列化又一个PHP反序列化 Misc这是邹节伦的桌面背景图什么鬼&#xff1f;…

基于STM32 HAL库的光电传感器驱动程序实例

本文将使用STM32 HAL库编写一个光电传感器的驱动程序示例。首先&#xff0c;我们会介绍光电传感器的工作原理和应用场景。然后&#xff0c;我们将讲解如何选择合适的STM32芯片和光电传感器组合。接下来&#xff0c;我们会详细介绍使用STM32 HAL库编写光电传感器驱动程序的基本步…

Kafka 生产者 API 指南:深入理解生产者的实现与最佳实践

Kafka 是一个高性能、分布式的消息中间件系统&#xff0c;而其生产者 API 是连接应用程序与 Kafka 集群之间的纽带。本篇博客将深入探讨 Kafka 生产者 API 的核心概念、用法&#xff0c;以及一些最佳实践&#xff0c;帮助你更好地利用 Kafka 构建可靠的消息生产系统。 1. Kafk…

一:对爬虫的简单认识

一&#xff1a;爬虫前导知识 1.爬虫引入&#xff1a; ​ 网络爬虫又称为网络蜘蛛&#xff1b;网络蚂蚁&#xff1b;网络机器人等&#xff0c;可以自动高效地从互联网的海量信息中浏览获取到我们感兴趣的信息&#xff0c;在浏览信息的时候需要按照我们制定的规则进行&#xff…