웅재의 코딩세상
[프로그래머스] 5명씩 본문
- 풀이
#include <string>
#include <vector>
using namespace std;
vector<string> solution(vector<string> names) {
vector<string> answer;
for(int i=0; i<names.size(); i++){
if(i % 5 == 0) answer.push_back(names[i]);
}
return answer;
}
반응형
'코딩테스트 > 프로그래머스 - LV 0' 카테고리의 다른 글
[프로그래머스] 문자열 뒤집기 (0) | 2024.01.31 |
---|---|
[프로그래머스] 특정한 문자를 대문자로 바꾸기 (0) | 2024.01.30 |
[프로그래머스] 주사위 게임 1 (0) | 2024.01.30 |
[프로그래머스] 공백으로 구분하기 2 (0) | 2024.01.30 |
[프로그래머스] 공백으로 구분하기 1 (0) | 2024.01.30 |