[프로그래머스/Java] Lv.0 수 조작하기 1
문제 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 class Solution { public int solution(int n, String control) { int ans = n; for (String s : control.split("")) { switch (s) { case "w" : { ans += 1; break; } case "s" : { ans -= 1; break; } case "d" : { ans += 10; break; } case "a" : { ans -= 10; break; } } } return ans; } } Colored by Color Scripter cs