1 static int wing=[]() 2 { 3 std::ios::sync_with_stdio(false); 4 cin.tie(NULL); 5 return 0; 6 }(); 7 8 class Solution 9 { 10 public: 11 int trailingZeroes(int n) 12 { 13 int res=0; 14 while(n>0) 15 { 16 int cur=n/5; 17 res+=cur; 18 n=cur; 19 } 20 return res; 21 } 22 };
这个计算数n的阶乘末尾0的个数的算法,可以记忆一波。