Skip to content

Commit 97c2794

Browse files
authored
Create count_divisor.py
1 parent f8b1cc4 commit 97c2794

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

programmers/Lv.1/count_divisor.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def solution(left, right):
2+
int_list = [0] * 1000
3+
for i in range(1, right + 1):
4+
for j in range(left, right + 1):
5+
if j >= i and j % i == 0:
6+
int_list[j] += 1
7+
# print(int_list[left : right + 1])
8+
answer = 0
9+
for i in range(left, right + 1):
10+
if int_list[i] % 2 == 0:
11+
answer += i
12+
else:
13+
answer -= i
14+
return answer

0 commit comments

Comments
 (0)