即求5的个数。 int count(int n) { int cnt = 0; while(n){ cnt += n/5; n /= 5; } return cnt; } 类似:求N!的二进制中1的个数。即因数中2的个数,将5换成2。