웅재의 코딩세상

[프로그래머스] 배열 만들기 1 본문

코딩테스트/프로그래머스 - LV 0

[프로그래머스] 배열 만들기 1

웅드 2024. 1. 25. 00:34

 

 

  • 풀이
#include <string>
#include <vector>

using namespace std;

vector<int> solution(int n, int k) {
    vector<int> answer;
    for(int i=1; i<= n/k; i++){
        answer.push_back(i*k);
    }
    return answer;
}
반응형