uploaded at 2022. 12. 17. 오후 8:37:50

This commit is contained in:
rl544
2022-12-17 20:37:51 +09:00
parent 60dbf9e9ad
commit 337253a3f8
@@ -0,0 +1,16 @@
// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/77884
class Solution {
public int solution(int left, int right) {
int answer = 0;
for(int a = left; a <= right; a++){
int c = 1;
for(int b = 1; b <= a/2; b++){
c+=(a%b==0)?1:0;
}
if(c%2==0) answer+= a;
else answer -= a;
}
return answer;
}
}