프로그래밍 언어 54

백준 > 1676 팩토리얼 0의 개수

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int count = 0; while (n > 4) { count += n / 5; n /= 5; } System.out.println(count); } } Colored by Color Scripter cs 어렵지 않은 문제였지만 여러 번 틀렸다. 이유는 1. 5의 제곱수를 생각하지 못함 2. 5로 나누면 안된다는 사실을 이해하지 못했음 2번이 이해가 좀 안되었었는데 https..

백준 > 2231 분해합

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 #define _CRT_SECURE_NO_WARNINGS #include int divide(int n); //각 자리수 구해주는 함수 int main() { int n; int i = 1; scanf("%d", &n); while (1) { //어차피 젤 작은 생성자 if (n == i + divide(i)) { printf("%d", i); break; } else if (i == n) { printf("0"); break; } i++; } } int divide(int n) { int arr[7] ..