#include <stdio.h> #include <iostream> #include <algorithm> #include <string> #include <vector> #include <math.h> using namespace std; int N; int two; int five; int main(void) { // freopen("B1676_input.txt", "r", stdin); cin >> N; for(int i = 2; i <= N; i++) { int temp = i; while(temp % 2 == 0) { temp /= 2; two++; } while(temp % 5 == 0) { temp /= 5; five++; } } cout << min(two, five); return 0; } | cs |
'Baekjoon > Math' 카테고리의 다른 글
[백준 4948] 베르트랑 공준 (Eratos) (C/C++) (0) | 2020.03.25 |
---|---|
[백준 2004] 조합 0의 개수 (Math) (C/C++) (★) (0) | 2020.01.25 |
[백준 11653] 소인수 분해 (Math) (C/C++) (0) | 2020.01.25 |
[백준 6658] 골드바흐의 추측 (Math) (C/C++) (★) (0) | 2020.01.25 |
[백준 11576] Base Conversion (Math) (C/C++) (0) | 2020.01.25 |