更新时间:2023-12-01 17:02:40
将doTowers
的返回类型从void
更改为int
,并将返回值设置为:
Change the return type of doTowers
from void
to int
, and set the return value to:
topN == 1
,则返回1; doTowers()
加1的总和.topN == 1
, return 1;doTowers()
plus 1.逻辑类似于问题的算法.玩弄找出来吧!
The logic is similar to the algorithm of the problem. Have fun figuring it out!
您还可以使用静态全局变量,但这可以说是不好的编程风格.
You could also use a static global variable, but that's arguably bad programming style.