프로그래머스 181931 등차수열의 특정한 항만 더하기

1 개요[ | ]

프로그래머스 181931 등차수열의 특정한 항만 더하기

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

int solution(int a, int d, vector<bool> included) {
    int answer = 0;
    for(int i=0; i<included.size(); i++) {
        if(!included[i]) continue;
        answer += a+i*d;
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}