数学技巧题

Posted xero10

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了数学技巧题相关的知识,希望对你有一定的参考价值。

Nim Game: https://leetcode.com/problems/nim-game/

n是4的倍数时一定失败

 

add digits: https://leetcode.com/problems/add-digits/

return 1 + (num - 1) % 9;

 

Factorial Trailing Zeros: https://leetcode.com/problems/factorial-trailing-zeroes/

返回5^1的个数 + 5^2的个数 + ... + 5^i的个数,其中5^(i+1) > n。从n开始依次÷5倒着往下比较快,并且保证数据不会溢出

 

 

以上是关于数学技巧题的主要内容,如果未能解决你的问题,请参考以下文章