And when you have an optimal substructure and the local solutions overlap, that's when you can bring dynamic programming to bear.
当你得到一个最优子结构,但局部解决方案有重跌时,你就可以引入动态编程,来解决这个问题了。
So I have two solutions here; one, what would be sort of the obvious sort of hackish or solve it fast solution?
我这里有两个解决方案,一是有没有一个明显的,独创性的,快速地解决方案?
We call that a base case. It's basically the simplest possible solution to the problem.
我们说这是一个基础案例,这是这个问题最简单的解决方案。
What caused it? It was caused maybe it's oversimplifying it it was caused by a change in our resolve to let's get inflation under control - and a willingness to accept the recession to stop the advance of inflation.
是什么引发了它,它是因为-也许过分的单纯化它,它是由于一个为了,让我们将通货膨胀控制在手中的解决方案,和一个接受经济衰退的愿望,结束通货膨胀的继续上涨所导致的。
So, thankfully, C does provide a solution for this, whereby, I can provide a hint, essentially, to the compiler.
幸亏,C为这个提供了一个解决方案,那样,本质上,我可以给编译器一个提示。
So, an alternative to that that is incredibly common in just the programming world and in industry is to actually not write programs on your own personal computer but to actually write and run them on a server, someplace where the software is all standardized.
那么,在编程界和工业界普遍,使用的一个解决方案是,不在你自己的电脑上写程序,而是在服务器上编程运行,服务器上的软件都是标准化的。
> Indeed. So there is a solution and that is the solution.
>,的确,这里有解决方案,那就是一个解决方案。
The heap offers us a solution to that problem.
堆就为那个问题提供了一个解决方案。
Ask yourself, will it fix all of the symptoms you've seen?
你第一个想到的修改方案,它能否解决你看到的所有症状?如果不行?
But it is a solution to this problem.
但这个是问题的一个解决方案。
So yes, f is a float, but that solution is too late; we need to fix the problem sooner.
是的,f是一个浮点数,但是那个解决方案太迟了;,我们应该在次之前把问题解决。
So it turns out there's a solution to this: If you need more precision, more digits after the decimal point than a float allows, what do you go for instead?
所以这里有一个解决方案:,如果你需要比float类型允许的更高精度,小数点后更多位数,那你该用什么取代它?
First of all, two parameters. It's OK. All it says is, when I call this, I need to pass in two parameters for this to work. All right? Now, if I want to use that, I'm going to use a second piece of code here, called Barnyard. I'm going Barnyard to read in a couple of values, convert them into integers, and then I'm going to use solve to get a solution out.
注意我得到了什么,第一,两个参数,它的意思就是我调用这个函数,我得给它输入两个参数,明白了吗?,现在如果我要使用它我得用,这里的第二段代码,也叫,我将读入一组值,将它们转化为整型,然后我会用solve得到一个解决方案。
应用推荐