웅재의 코딩세상
[프로그래머스] 수 조작하기 1 본문
- 풀이
#include <string>
#include <vector>
#include <map>
using namespace std;
map <char, int> mp = {{'w', 1}, {'s', -1}, {'d', 10}, {'a', -10}};
int solution(int n, string control) {
for(auto c : control){
n += mp[c];
}
return n;
}
반응형
'코딩테스트 > 프로그래머스 - LV 0' 카테고리의 다른 글
[프로그래머스] 정수 찾기 (0) | 2024.01.25 |
---|---|
[프로그래머스] 조건에 맞게 수열 변환하기 1 (0) | 2024.01.25 |
[프로그래머스] 정수 부분 (0) | 2024.01.25 |
[프로그래머스] 조건 문자열 (0) | 2024.01.25 |
[프로그래머스] n 번째 원소까지 (1) | 2024.01.25 |