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. vue-element-ui upload组件调用两次接口

    在使用upload中,默认是自动上传,会发现会调用两次接口,一次是Request Method: OPTIONS且不带任何参数(群里大佬说是跨域 预检测),一次是Request Method: POS ...

  2. webpack4导入jQuery的新方案

    本文的目的 拒绝全局导入jQuery!! 拒绝script导入jQuery!! 找到一种只在当前js组件中引入jQuery,并且使用webpack切割打包的方案! 测试环境 以下测试在webpack3 ...

  3. EF部分字段修改 自动忽略为null字段

    传入一个实体 student(){id = 1,name = "测试" age = null,sex = null} 下面 是修改的方法 public async Task Edi ...

  4. 2019-11-29-win10-uwp-如何开始写-uwp-程序

    title author date CreateTime categories win10 uwp 如何开始写 uwp 程序 lindexi 2019-11-29 10:12:42 +0800 201 ...

  5. Nginx 别名访问

    #添加另一个域名,在浏览器中输入 etiantian.org,总是调到 www.etiantian.org server { listen            80; server_name   w ...

  6. ARM工作模式寻址

    用户模式(User)                 usr 快速中断模式(FIQ) fiq 普通终端模式(IRQ)     irq 保护模式(Supervisor) svc 数据访问终止模式(Abo ...

  7. neutron网络实践

    一.虚拟机获取 ip: 用 namspace 隔离 DHCP 服务 Neutron 通过 dnsmasq 提供 DHCP 服务,而 dnsmasq 通过 Linux Network Namespace ...

  8. Qualcomm_Mobile_OpenCL.pdf 翻译-3

    3 在骁龙上使用OpenCL 在今天安卓操作系统和IOT(Internet of Things)市场上,骁龙是性能最强的也是最被广泛使用的芯片.骁龙的手机平台将最好的组件组合在一起放到了单个芯片上,这 ...

  9. ARM汇编 汇编文件后缀.s与.S

    有两套汇编的语法: ARM公司的标准ARM汇编语言和GNU对ARM支持的GNU ARM汇编. ARM标准汇编语言即ARM公司的开发工具ADS里用的汇编语言: GNU汇编即在Linux下用GCC编译的汇 ...

  10. 查看系统的DPI

    #include <Windows.h> #include <iostream> int main() { SetProcessDpiAwarenessContext(DPI_ ...