알고리즘

C++ 알고리즘 - 백준 1676 팩토리얼 0의 개수

마루설아 2024. 12. 29. 12:50

https://www.acmicpc.net/problem/1676

 

#include <iostream>
#define endl "\n"

using namespace std;

int main(void) {
	// C++ Init
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	int num;
	int chk = 0;

	cin >> num;

	while (num >= 5) {
		chk += num / 5;
		num /= 5;
	}

	cout << chk;
}