본문 바로가기
알고리즘 & 자료구조/백준

백준 1676

by 신재권 2021. 8. 16.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main1676 {

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(br.readLine());
		int cnt = 0;
		int result = 0;
		int i = 1;
		//0의 개수를 구하는 방법 
		// 소인수 분해 했을 때 5의 개수를 찾아주면 된다.
		
		while(result < N){
			result = (int) Math.pow(5, i);
			cnt += (N/result);
			i++;
		}
		
		System.out.println(cnt);
	}
	
}

'알고리즘 & 자료구조 > 백준' 카테고리의 다른 글

백준 2004  (0) 2021.08.16
벡준 10872  (0) 2021.08.16
백준 6588  (0) 2021.08.14
백준 1929  (0) 2021.08.12
백준 1978  (0) 2021.08.12