diff --git a/kokeunho/README.md b/kokeunho/README.md index 20d71ca..f3804ef 100644 --- a/kokeunho/README.md +++ b/kokeunho/README.md @@ -4,4 +4,6 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.09.28 | 구현 | [킹](https://www.acmicpc.net/problem/1063) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/1) | | 2차시 | 2024.10.01 | 다이나믹 프로그래밍 | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#5] (https://github.com/AlgoLeadMe/AlgoLeadMe-12/pulls/4) | +| 3차시 | 2024.10.08 | 구현 | [약수들의 합](https://www.acmicpc.net/problem/9506) | [#14] (https://github.com/AlgoLeadMe/AlgoLeadMe-12/pulls/14) | + --- diff --git "a/kokeunho/\352\265\254\355\230\204/3-kokeunho.py" "b/kokeunho/\352\265\254\355\230\204/3-kokeunho.py" new file mode 100644 index 0000000..4a8a39c --- /dev/null +++ "b/kokeunho/\352\265\254\355\230\204/3-kokeunho.py" @@ -0,0 +1,30 @@ +while True: + n = int(input()) + if (n == -1): + break + else: + sum = 0 + factors = [] + + for i in range(1, n): + if (n % i == 0): + factors.append(i) + sum += i + + + if (sum == n): + print(f"{n} =", end=' ') + for i in range(len(factors)): + print(factors[i], end=' ') + if (i != (len(factors) - 1)): + print("+", end=' ') + else: + print(end='\n') + else: + print(f"{n} is NOT perfect.") + + + + + +