We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38d7a5a commit a7081f9Copy full SHA for a7081f9
programmers/Lv.1/count_divisor.py
@@ -1,13 +1,13 @@
1
def solution(left, right):
2
- int_list = [0] * 1000
+ int_list = [0] * (right - left + 1)
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
+ int_list[j - left] += 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:
+ if int_list[i - left] % 2 == 0:
11
answer += i
12
else:
13
answer -= i
0 commit comments