如何使用回溯法进行面包店代码挑战?

时间:2018-11-26 23:28:16

标签: javascript algorithm backtracking

我试图使用回溯来实现面包店代码挑战。 The question is here

到目前为止,我明白了

//A = 1 if x <= min
//A = 0 if x >= min
A = 1-(min-min/x)/min 

//B = 0 if x <= max
//B = 1 if x > max
B = (max-max/x)/max

x = A*min + (1-A)*(1-B)*x + B*max

我所知道的是对于14号 我们有14-2 = 12、14-5 = 9、14-8 = 6。然后,我们需要继续下降。 如何实际以递归方式实现?

0 个答案:

没有答案
相关问题