Skip to content

Commit a59546c

Browse files
committed
내풀이
1 parent 9b70ab5 commit a59546c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
def solution(left, right):
2+
answer = 0
3+
4+
def count(x):
5+
cnt=0
6+
7+
if x == 1:
8+
return 1
9+
10+
11+
for i in range(1, ((x+1)//2)+1):
12+
if x%i == 0:
13+
cnt += 1
14+
15+
if cnt % 2 != 0:
16+
cnt -= 1
17+
cnt *= 2
18+
cnt += 1
19+
else :
20+
cnt *=2
21+
22+
return cnt+2
23+
24+
25+
for num in range(left, right+1):
26+
if count(num) % 2 == 0:
27+
answer -= num
28+
else:
29+
answer += num
30+
31+
return answer

0 commit comments

Comments
 (0)