-
一、前言
24点游戏是一个常见游戏,出题者给出4个整数,要求答题者在指定时间内给出一个四则运算的表达式,恰好用上这这个整数各一次,计算结果为24,超出时间为...
一、前言
24点游戏是一个常见游戏,出题者给出4个整数,要求答题者在指定时间内给出一个四则运算的表达式,恰好用上这这个整数各一次,计算结果为24,超出时间为输。
二、分析
用计算机来算这个题,搜索速度当然有很大优势,我编程喜欢考虑通用一点,不限制输入数量和结果数,甚至不限制运算符数量。这样组合数就很大,如果输入数比较多,则搜索时间会非常长。
我用两个方法来提高搜索速度:一、是大家都能考虑到的重复搜索问题,比如1,2,3和2,3,1所有的组合情况是相同的,我只搜索使用递增序的数组,则可以降低一个组合数的数量级别;二、使用动态规划中的备忘录方法,比如你计算出2和3所有可能的计算结果,则他们与4结合的时候,要用到,与1结合的时候,也要用到,使用备忘录,可以只计算一次,大大降低运算复杂度。
三、设计
整体设计:分别设计4个类:游戏、表达式、运算、分数,各司其责,结构清晰,易于扩展。
-First, the preamble
24-point game is a common game, give the title are four integer requiring answer within a specified period of time in a four calculations give the expression, just use that the integral of the time, results for the 24, beyond the time to lose.
Second, analysis
Use computers to count the title, the search speed of course, there is a great advantage, I enjoy taking generic programming that does not restrict the importation of the volume and the number of results, and even limiting the number of operators. So on a large number of combinations, if you
- 2022-04-21 18:17:05下载
- 积分:1
-
支持多道进程并发的简单管理模拟系统
支持多道进程并发的简单管理模拟系统-Support for multi-channel process complicated by the simple management simulation system
- 2022-07-26 06:54:45下载
- 积分:1
-
人工蜂群
这是人工蜂群蚁群算法 matlab m 文件。这种优化算法由德尔维什 Karaboga.The algortihm 非常简单,它是非常有用。
- 2023-08-02 10:25:04下载
- 积分:1
-
层次型隐含狄利克雷分布
海量数据中包含一个或者多个主题,可以通过面向主题模型的算法求解。lda是其中一个典型代表。然后,这些主题模型本身又包含丰富的结构,如,层次型结构。这里给出的是一种进行层次型主题发现的算法。
- 2022-07-14 11:20:19下载
- 积分:1
-
这是我用三次样条函数插值法的程序。
这是我编的利用三次样条法进行函数插值的程序。-This is for my use of cubic spline function interpolation method procedures.
- 2023-07-12 22:15:03下载
- 积分:1
-
卡尔曼滤波是一种重要的数字视频图象跟踪方法。
卡尔曼滤波是一种重要的数字视频图象跟踪方法。-Kalman filtering is an important digital video image tracking method.
- 2023-07-24 14:10:03下载
- 积分:1
-
利用最佳一致逼近设计数字滤波器的程序,根据提示输入参数,程序输出单位取样响应h[n]...
利用最佳一致逼近设计数字滤波器的程序,根据提示输入参数,程序输出单位取样响应h[n]-use the best approximation of the digital filter design process, according to suggest input parameters, output units sampling procedures response h [n]
- 2023-05-04 19:05:03下载
- 积分:1
-
Started Jacobian symbols used to calculate Legendre symbol for the value judgmen...
新手上路 用雅可比符号来计算勒让德符号的值 用于判断与素数p互素的正整数n是否是mod p 的二次剩余-Started Jacobian symbols used to calculate Legendre symbol for the value judgment and mutual-p-a positive integer n is whether the mod p Quadratic Residue
- 2022-07-24 00:22:37下载
- 积分:1
-
a full 3D simulation of electromagnetic waves with efficient absorbing boundary...
a full 3D simulation of electromagnetic waves with efficient absorbing boundary a full 3D simulation of electromagnetic waves with efficient absorbing boundary conditions SYNOPSIS- a full 3D simulation of electromagnetic waves with efficient absorbing boundary a full 3D simulation of electromagnetic waves with efficient absorbing boundary conditions SYNOPSIS
- 2022-05-25 07:53:42下载
- 积分:1
-
dsp小程序
dsp小程序,用于研究开发dsp小程序,用于研究开发dsp小程序,用于研究开发dsp小程序,用于研究开发dsp小程序,用于研究开发dsp小程序,用于研究开发dsp小程序,用于研究开发
- 2022-01-28 16:20:29下载
- 积分:1