我在CS求职面试时遇到了这个问题.我不知道它,更不用说实现代码......
我能得到一些提示吗?
PS exp()是函数y = e ^ x和ln()是y = ln(x)
我的Euler Project 14代码如下.我已经运行此代码超过3个小时的输出结果,它似乎是无限的.当我测试单个数字(如11,27)时,它将快速输出collatz链数:14和111.但我不知道为什么它不能输出1000000数字的最大链数.
/*Problem 14
* The following iterative sequence is defined for the set of positive integers:
* n -> n/2 (n is even)
* n -> 3n + 1 (n is odd)
* Using the rule above and starting with 13, we generate the following sequence:
* 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1
* It can be seen that this sequence (starting at 13 and …Run Code Online (Sandbox Code Playgroud) 我想在范围[a,b]和[c,d]或更多范围内做一些事情.
例如,我想在1~10之间的行中用"def"替换"abc",在50~60之间的行中替换.我将在下面进行两个编辑操作:
我可以只用一个命令吗?