프로그래머스 181926 수 조작하기 1

1 개요[ | ]

프로그래머스 181926 수 조작하기 1

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

int solution(int n, string control) {
    for(int i=0; i<control.length(); i++) {
        switch(control[i]) {
            case 'w': n++; break;
            case 's': n--; break;
            case 'd': n+=10; break;
            case 'a': n-=10; break;
        }
    }
    return n;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}