mycode

问题:为甚在小于200的时候,答案ok,大于等于200的时候,就少一个1???

class Solution(object):
def trailingZeroes(self, n):
"""
:type n: int
:rtype: int
"""
if n<1:
return 0
k = 5
count = 0
while n // k:
count += n // k
k = k*k
#count_2 = 1 if n%10==0 else 0
#if n < 200:
# return count
return count
#30-》 30 .。25.。。20。。15.。。没有数25中的另外一个5!

参考

class Solution(object):
def trailingZeroes(self, n):
"""
:type n: int
:rtype: int
"""
return 0 if n == 0 else n / 5 + self.trailingZeroes(n / 5)

leetcode-mid-math-172. Factorial Trailing Zeroes-NO-????的更多相关文章

  1. 【leetcode❤python】172. Factorial Trailing Zeroes

    #-*- coding: UTF-8 -*-#给定一个整数N,那么N的阶乘N!末尾有多少个0? 比如:N=10,N!=3628800,N!的末尾有2个0.#所有的尾部的0可以看做都是2*5得来的,所以 ...

  2. 【LeetCode】172. Factorial Trailing Zeroes

    Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Note: Your ...

  3. [LeetCode] 172. Factorial Trailing Zeroes 求阶乘末尾零的个数

    Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explan ...

  4. LeetCode 172. Factorial Trailing Zeroes (阶乘末尾零的数量)

    Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...

  5. Java for LeetCode 172 Factorial Trailing Zeroes

    Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...

  6. 【一天一道LeetCode】#172. Factorial Trailing Zeroes

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...

  7. Java 计算N阶乘末尾0的个数-LeetCode 172 Factorial Trailing Zeroes

    题目 Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in ...

  8. ✡ leetcode 172. Factorial Trailing Zeroes 阶乘中的结尾0个数--------- java

    Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...

  9. Java [Leetcode 172]Factorial Trailing Zeroes

    题目描述: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be ...

  10. 【LeetCode】172. Factorial Trailing Zeroes 解题报告(Java & Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 递归 循环 日期 题目描述 Given an integer ...

随机推荐

  1. 10.AutoMapper 之自定义值解析器(Custom Value Resolvers)

    https://www.jianshu.com/p/3e7cf1d1f17d 自定义值解析器(Custom Value Resolvers) 虽然AutoMapper涵盖了相当多的目标成员映射方案,但 ...

  2. Hack the box: Bastion

    介绍 目标:10.10.10.134 (Windows) Kali:10.10.16.65 In conclusion, Bastion is not a medium box. But it wou ...

  3. git大全转

    git原理:https://git-scm.com/book/zh/v2 http://blog.xiayf.cn/2013/09/28/learning-git-internals-by-examp ...

  4. join 与 countdownlatch 的区别 扩展 栅栏 CyclicBarrier

    我们先看一个 小例子 , 使用 join 与CountDownSlatch 都可以完成 当1,2线程 完全结束后 3 线程 start 对比我们就能够知道 CountDownSlatch 比 JOIN ...

  5. 32-第3章 数据链路层--抓包分析数据帧格式-ISO一图了然-小结

    OSI理论模型 层级 名称 事物举例 功能 数据单位 别名 数据组成 协议举例 7 应用层 QQ.OA 网络通信 上层数据 上层数据 HTTP/FTP/DNS 6 表示层 web数据压缩.https加 ...

  6. linux ssh连接超时断连设置

    以下均针对redhat6.5系统进行说明. 一.设置ssh超时断连 使用root用户,编辑/etc/profile文件,在 HOSTNAME='/bin/hostname' HISTIZE=30 后增 ...

  7. VIM如何自动保存文件、自动重加载文件、自动刷新显示文件

    1.手动重加载文件的命令是:e! 2.一劳永逸的方法是:vim提供了自动加载的选项 autoread,默认关闭. 在vimrc中添加 set autoread即可打开自动加载选项,相关选项: :hel ...

  8. 文件I/O编程 (select)

    Select的I/O多路转接模型是处理I/O复用的一个高效方法.Select函数语法要点所需头文件: #include<sys/types.h> #include<sys/time. ...

  9. outlook 使用临时邮箱 使用旧数据

    控制面板-->邮件32位 显示配置文件 删除再添加 具体可参考 https://blog.csdn.net/liuyukuan/article/details/80043840 偷懒,图片从网上 ...

  10. vue 无缝滚动文字

    前言 用vue做无缝滚动,字体弹幕 就上代码吧 <head> <meta charset="UTF-8"> <style> div, ul, l ...