Skip to content

Commit

Permalink
이슈 #353에서 솔루션 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 21, 2024
1 parent aa6f7ae commit 5da3957
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Programmers/합성수_찾기.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <string>
#include <vector>

using namespace std;

int countDivisors(int n) {
int count = 0;

for (int i = 1; i <= n; i++) {
if (n % i == 0) {
count++;
}
}

return count;
}

int solution(int n) {
int answer = 0;

for (int i = 1; i <= n; i++) {
if (countDivisors(i) >= 3) {
answer++;
}
}

return answer;
}

0 comments on commit 5da3957

Please sign in to comment.