problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::factorial_trailing_zeroes::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int trailingZeroes (int n)
 

详细描述

在文件 leetcode.h1910 行定义.

成员函数说明

◆ trailingZeroes()

int leetcode::factorial_trailing_zeroes::Solution::trailingZeroes ( int  n)
static

在文件 leetcode.cpp5011 行定义.

5011 {
5012 unsigned int pow5 = 5;
5013 unsigned int pow2 = 2;
5014 unsigned int count5 = 0;
5015 unsigned int count2 = 0;
5016 while(n / pow5 != 0) {
5017 count5 += n / pow5;
5018 pow5 *= 5;
5019 }
5020 while(n / pow2 != 0) {
5021 count2 += n / pow2;
5022 pow2 *= 2;
5023 }
5024 return min(count2, count5);
5025 }

被这些函数引用 leetcode::factorial_trailing_zeroes::TEST().


该类的文档由以下文件生成: