uploaded at 2022. 12. 18. 오후 4:58:56

This commit is contained in:
rl544
2022-12-18 16:58:57 +09:00
parent 9195cf0d7d
commit 6f4f5e7164
@@ -0,0 +1,13 @@
// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/12924
class Solution {
public int solution(int n) {
int answer = 0;
for(int i = 1; i <= n; i++){
int nn = n-(i*(i-1)/2);
if (nn < 1) break;
else if (nn%i==0) answer ++;
}
return answer;
}
}