当前位置:网站首页>20220601数学:阶乘后的零
20220601数学:阶乘后的零
2022-07-03 09:20:00 【丿SeeYouAgain】
题目描述:给定一个整数 n
,返回 n!
结果中尾随零的数量。提示 n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1。
编码实现:
public int trailingZeroes(int n) {
int result = 0;
while (n >= 5){
result += n/5;
n /= 5;
}
return result;
}
边栏推荐
- 20220610其他:任务调度器
- 2021-10-28
- JS foundation - prototype prototype chain and macro task / micro task / event mechanism
- Leetcode - 933 number of recent requests
- QT detection card reader analog keyboard input
- STM32 running lantern experiment - library function version
- Google browser plug-in recommendation
- Leetcode - 895 maximum frequency stack (Design - hash table + priority queue hash table + stack)*
- The new series of MCU also continues the two advantages of STM32 product family: low voltage and energy saving
- 4G module IMEI of charging pile design
猜你喜欢
Basic knowledge of communication interface
LeetCode - 919. Full binary tree inserter (array)
Yocto Technology Sharing Phase 4: Custom add package support
CV learning notes - edge extraction
Pymssql controls SQL for Chinese queries
My notes on the development of intelligent charging pile (III): overview of the overall design of the system software
QT is a method of batch modifying the style of a certain type of control after naming the control
openCV+dlib实现给蒙娜丽莎换脸
2021-10-28
LeetCode - 5 最长回文子串
随机推荐
CV learning notes - image filter
Dictionary tree prefix tree trie
Circular queue related design and implementation reference 1
03 fastjason solves circular references
Leetcode 300 longest ascending subsequence
Problems encountered when MySQL saves CSV files
Positive and negative sample division and architecture understanding in image classification and target detection
Serial port programming
2.Elment Ui 日期选择器 格式化问题
Toolbutton property settings
Connect Alibaba cloud servers in the form of key pairs
pycharm 无法引入自定义包
01 business structure of imitation station B project
LeetCode - 460 LFU 缓存(设计 - 哈希表+双向链表 哈希表+平衡二叉树(TreeSet))*
yocto 技術分享第四期:自定義增加軟件包支持
Leetcode bit operation
LeetCode - 933 最近的请求次数
On the problem of reference assignment to reference
Opencv Harris corner detection
Openeuler kernel technology sharing - Issue 1 - kdump basic principle, use and case introduction