leetcode-mid-math-172. Factorial Trailing Zeroes-NO-????
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-????的更多相关文章
- 【leetcode❤python】172. Factorial Trailing Zeroes
#-*- coding: UTF-8 -*-#给定一个整数N,那么N的阶乘N!末尾有多少个0? 比如:N=10,N!=3628800,N!的末尾有2个0.#所有的尾部的0可以看做都是2*5得来的,所以 ...
- 【LeetCode】172. Factorial Trailing Zeroes
Factorial Trailing Zeroes Given an integer n, return the number of trailing zeroes in n!. Note: Your ...
- [LeetCode] 172. Factorial Trailing Zeroes 求阶乘末尾零的个数
Given an integer n, return the number of trailing zeroes in n!. Example 1: Input: 3 Output: 0 Explan ...
- LeetCode 172. Factorial Trailing Zeroes (阶乘末尾零的数量)
Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...
- 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 ...
- 【一天一道LeetCode】#172. Factorial Trailing Zeroes
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...
- 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 ...
- ✡ 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 ...
- Java [Leetcode 172]Factorial Trailing Zeroes
题目描述: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be ...
- 【LeetCode】172. Factorial Trailing Zeroes 解题报告(Java & Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 递归 循环 日期 题目描述 Given an integer ...
随机推荐
- ivew组件上传图片文件的功能:
解决的问题: 1.使用view的<Upload>组件实现图片文件的上传. 2.<Upload>组件action请求地址无法到自己写的后台. 3.前台base64的图片展示. 4 ...
- SpringBoot集合Linux的FastDFS与Nginx上传图片测试错误com.github.tobato.fastdfs.exception.FdfsConnectException: 无法获取服务端连接资源:can't create connection to/192.168.1.104:22122
报错 com.github.tobato.fastdfs.exception.FdfsConnectException: 无法获取服务端连接资源:can't create connection to/ ...
- python 重学
-------------------------
- 批量恢复zencart产品表所属分类master_categories_id为0的产品
批量恢复zencart产品表所属分类master_categories_id为0的产品 将下面代码保存为master_categories_id.php,上传到网站根目录运行即可,操作前先备份数据库 ...
- Codeforces Gym 100814C Connecting Graph 树剖并查集/LCA并查集
初始的时候有一个只有n个点的图(n <= 1e5), 现在进行m( m <= 1e5 )次操作 每次操作要么添加一条无向边, 要么询问之前结点u和v最早在哪一次操作的时候连通了 /* * ...
- npm 发布 vue 组件
创建 vue 组件 1.创建vue项目,为了简洁方便,推荐使用webpack-simple构建一个项目 vue init webpack-simple your-project 2.在 src 目录下 ...
- 《Head First 软件开发》阅读四
构建代码:自动化构建 代码的完成不只是能运行,还包括编译代码和打包成可配置的单元.学会一个构建工具来编写自己的说明处理源代码.新的团队成员需要立刻知道软件的关联组件和主要类去做测试,但开发人员不是心理 ...
- Gym-100923L-Por Costel and the Semipalindromes(进制转换,数学)
链接: https://vjudge.net/problem/Gym-100923L 题意: Por Costel the pig, our programmer in-training, has r ...
- react在视频中截图,保存为base64位
wq:之前看了网上很多教程,有点模糊,但是最后还是搞了出来 1 不要将视频放到canvas上面! 之前一直将video重新画到canvas上面,然后再次将第一个canvas放到第二个canvas上 ...
- 【转】Linux逻辑卷管理
一. 前言 LVM是逻辑卷管理(Logical Volume Manager)的简称,它是建立在物理存储设备之上的一个抽象层,允许你生成逻辑存储卷,与直接使用物理存储在管理上相比,提供了更好灵活性.L ...