给定一个非负整数N,返回N!结果的末尾为0的数量
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = Long.parseLong(br.readLine().trim()); long count = 0; while(n > 0){ count += n / 5; n /= 5; } System.out.println(count); } }
def numOfZero(n): num, i = 0, 5 while i <= n: num += n // i i *= 5 return num n = eval(input()) print(numOfZero(n))