728x90
반응형
SMALL
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(int n) {
int answer = 0;
vector<int> nums1;
// n의 약수들을 구해서 오름차순, 내림차순 각각 구하기
for(int i=1; i<n+1; i++){
if(n%i==0)
nums1.push_back(i);
}
return nums1.size();
}
728x90
반응형
LIST
'C++' 카테고리의 다른 글
| [프로그래머스] 배열 원소의 길이 (0) | 2025.09.04 |
|---|---|
| [프로그래머스] n의 배수 고르기 (0) | 2025.09.04 |
| [프로그래머스] 배열의 유사도 (0) | 2025.09.04 |
| [프로그래머스] 점의 위치 구하기 (0) | 2025.09.04 |
| [프로그래머스] 배열 자르기 (0) | 2025.09.03 |
댓글