728x90
반응형
SMALL
#include <string>
#include <vector>
using namespace std;
int solution(string my_string) {
int answer = 0;
for(char str : my_string){
if(str >= '1' && str <='9')
answer+=(int)str-'0';
}
return answer;
}
728x90
반응형
LIST
'C++' 카테고리의 다른 글
[프로그래머스] 암호 해독 (0) | 2025.09.05 |
---|---|
[프로그래머스] 최댓값 만들기 (2) (0) | 2025.09.05 |
[프로그래머스] 문자열 정렬하기 (1) (0) | 2025.09.05 |
[프로그래머스] 주사위의 개수 (0) | 2025.09.05 |
[프로그래머스] 가위 바위 보 (0) | 2025.09.05 |
댓글