Skip to content

Commit

Permalink
2024-10-08 약수의 합
Browse files Browse the repository at this point in the history
  • Loading branch information
kokeunho committed Oct 7, 2024
1 parent 8a261a4 commit 2930949
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions kokeunho/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
---
30 changes: 30 additions & 0 deletions kokeunho/구현/3-kokeunho.py
Original file line number Diff line number Diff line change
@@ -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.")






0 comments on commit 2930949

Please sign in to comment.