You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
349 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package etc.ali.q2;
/**
* 找因子直接遍历o(n)超时)
*/
public class Solution {
public int trailingZeroes(int num) {
int rs = 0;
for (int i = 1; i <= num; i++) {
int j = i;
while (j % 5 == 0) {
rs++;
j /= 5;
}
}
return rs;
}
}