본문 바로가기
C++

[프로그래머스] 암호 해독

by 띰쥬 2025. 9. 5.
728x90
반응형
SMALL

#include <string>
#include <vector>

using namespace std;

string solution(string cipher, int code) {
    string answer = "";
    
    //code의 배수번째만 진짜 암호
    for(int i=code; i<cipher.length()+1; i+=code)
        answer+=cipher[i-1];

    return answer;
}

728x90
반응형
LIST

댓글