牛客题霸-算法篇
有关阶乘的两个问题1
相似的企业真题
时间限制:C/C++ 2秒,其他语言4秒
空间限制:C/C++ 256M,其他语言512M
热度指数:895
本题知识点:
数学
算法知识视频讲解
校招时部分企业笔试将禁止编程题跳出页面,为提前适应,练习时请使用在线自测,而非本地IDE。
题目描述
给定一个非负整数N,返回N!结果的末尾为0的数量
示例1
输入
复制
3
3
返回值
复制
0
0
说明
3!=6
示例2
输入
复制
5
5
返回值
复制
1
1
说明
5!=120
示例3
输入
复制
1000000000
1000000000
返回值
复制
249999998
249999998
备注:
上一题
下一题
登录
/
注册
我的提交
编辑器加载中...
import java.util.*; public class Solution { /** * the number of 0 * @param n long长整型 the number * @return long长整型 */ public long thenumberof0 (long n) { // write code here } }
class Solution { public: /** * the number of 0 * @param n long长整型 the number * @return long长整型 */ long long thenumberof0(long long n) { // write code here } };
# # the number of 0 # @param n long长整型 the number # @return long长整型 # class Solution: def thenumberof0(self , n ): # write code here
/** * the number of 0 * @param n long长整型 the number * @return long长整型 */ function thenumberof0( n ) { // write code here } module.exports = { thenumberof0 : thenumberof0 };
# # the number of 0 # @param n long长整型 the number # @return long长整型 # class Solution: def thenumberof0(self , n ): # write code here
package main /** * the number of 0 * @param n long长整型 the number * @return long长整型 */ func thenumberof0( n int64 ) int64 { // write code here }
/** * the number of 0 * @param n long长整型 the number * @return long长整型 */ long long thenumberof0(long long n ) { // write code here }
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # the number of 0 # @param n long长整型 the number # @return long长整型 # class Solution def thenumberof0(n) # write code here end end
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * the number of 0 * @param n long长整型 the number * @return long长整型 */ def thenumberof0(n: Long): Long = { // write code here } }
object Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * the number of 0 * @param n long长整型 the number * @return long长整型 */ fun thenumberof0(n: Long): Long { // write code here } }
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * the number of 0 * @param n long长整型 the number * @return long长整型 */ public long thenumberof0 (long n) { // write code here } }
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * the number of 0 * @param n long长整型 the number * @return long长整型 */ export function thenumberof0(n: number): number { // write code here }
public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * the number of 0 * @param n long长整型 the number * @return long长整型 */ func thenumberof0 ( _ n: Int64) -> Int64 { // write code here } }
struct Solution{ } impl Solution { fn new() -> Self { Solution{} } /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * the number of 0 * @param n long长整型 the number * @return long长整型 */ pub fn thenumberof0(&self, n: i64) -> i64 { // write code here } }
3
0
5
1
1000000000
249999998