uploaded at 2022. 12. 18. 오후 9:50:37
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// [문제 링크]: https://school.programmers.co.kr/learn/courses/30/lessons/120846?language=java
|
||||
|
||||
class Solution {
|
||||
public int solution(int n) {
|
||||
int answer = 0;
|
||||
for(int i = 1; i <= n; i++){
|
||||
int temp = 0;
|
||||
for(int j = 1; j <= i; j++){
|
||||
temp += (i%j==0)?1:0;
|
||||
if(temp>2) break;
|
||||
}
|
||||
if(temp>2) answer++;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user