Skip to content

Commit fe38abd

Browse files
committed
[level 1] Title: 약수의 합, Time: 0.02 ms, Memory: 85.8 MB -BaekjoonHub
1 parent 8326564 commit fe38abd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

프로그래머스/1/12928. 약수의 합/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### 성능 요약
66

7-
메모리: 73.7 MB, 시간: 0.05 ms
7+
메모리: 85.8 MB, 시간: 0.02 ms
88

99
### 구분
1010

@@ -16,7 +16,7 @@
1616

1717
### 제출 일자
1818

19-
2026년 06월 21일 13:57:35
19+
2026년 06월 21일 14:04:23
2020

2121
### 문제 설명
2222

프로그래머스/1/12928. 약수의 합/약수의 합.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ class Solution {
22
public int solution(int n) {
33
int ans = 0;
44

5-
for (int i = 1; i <= n; i++) {
5+
for (int i = 1; i*i <= n; i++) {
66
if (n % i == 0) {
77
ans += i;
8+
9+
if (i != n /i) {
10+
ans += n/i;
11+
}
812
}
913
}
1014
return ans;

0 commit comments

Comments
 (0)