프로그래머스 181912 배열 만들기 5

Jmnote (토론 | 기여)님의 2023년 9월 10일 (일) 17:49 판 (새 문서: ==개요== {{프로그래머스|레벨=0|페이지=3}} ==C++== <syntaxhighlight lang='cpp'> #include <string> #include <vector> using namespace std; vector<int> solution(vector<str...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

프로그래머스 181912 배열 만들기 5


2 C++

#include <string>
#include <vector>

using namespace std;

vector<int> solution(vector<string> intStrs, int k, int s, int l) {
    vector<int> answer;
    int n;
    for(auto& str: intStrs) {
        n = atoi(str.substr(s,l).c_str());
        if(n>k) answer.push_back(n);
    }
    return answer;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}