[백준] P1676

동민·2021년 3월 11일
0
import java.util.Scanner;

public class P1676 {

	static long n,s,i,count;
	
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		n = sc.nextLong();

		s = factorial(n);
		
		i = 10;
		count = 0;
		while (s % i == 0) {
			count++;
			i *= 10;
		}
		System.out.println(count);

		sc.close();

	}

	public static long factorial(long n) {

		if(n <= 1) {
			return n;
		}
		else {
			return factorial(n-1) * n;
		}

	}

}
profile
BE Developer

0개의 댓글