코딩테스트/프로그래머스

[레벨1] x만큼 간격이 있는 n개의 숫자

marmelo12 2021. 8. 17. 21:38
반응형
#include <string>
#include <vector>

using namespace std;

vector<long long> solution(int x, int n) {
    vector<long long> answer;
    int i;
    for(i = 0; i < n; ++i)
        answer.push_back(x + x * i);
    
    return answer;
}

 

반응형