Codewars Java练习:Number of trailing zeros of N!

题目

Write a program that will calculate the number of trailing zeros in a factorial of a given number.

N! = 1 * 2 * 3 * ... * N

Be careful 1000! has 2568 digits…

For more info, see: http://mathworld.wolfram.com/Factorial.html

Examples

Hint: You’re not meant to calculate the factorial. Find another way to find the number of zeros.

题解

这也是5级题???升级好慢==

统计1-n中5出现了多少次就好了。

 

 

原创文章地址:【Codewars Java练习:Number of trailing zeros of N!】,转载时请注明出处mhy12345.xyz

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.