diff --git a/kokeunho/README.md b/kokeunho/README.md index ccb5b66..405d5a2 100644 --- a/kokeunho/README.md +++ b/kokeunho/README.md @@ -3,4 +3,5 @@ | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.09.28 | 구현 | [킹](https://www.acmicpc.net/problem/1063) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/1) | +| 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.") + + + + + +