Post

Programmers_x만큼 간격이 있는 n개의 숫자

프로그래머스 - x만큼 간격이 있는 n개의 숫자 문제 입니다.

1. 문제

https://programmers.co.kr/learn/courses/30/lessons/12954


2. 분류 및 난이도

Programmers 문제입니다.
Level 1난이도의 문제입니다.


3. 생각한 것들(문제 접근 방법)

  • 직관적이고 쉬운 문제입니다.

4. 접근 방법을 적용한 코드

1
2
3
4
5
6
7
8
9
10
11
#include <string>
#include <vector>

using namespace std;

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

5. 결과

필요시.

This post is licensed under CC BY 4.0 by the author.