1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include <string> using namespace std; bool solution(string s) { if(!(s.length() == 4 || s.length() == 6)) return false; for(int i = 0; i < s.length(); i ++){ if(!('0' <= s[i] && s[i] <= '9')) return false; } return true; } | cs |
'Problem-solving > 프로그래머스' 카테고리의 다른 글
프로그래머스 - 소수 찾기 (C++) (0) | 2020.03.06 |
---|---|
프로그래머스 - 서울에서 김서방 찾기 (C++) (0) | 2020.03.05 |
프로그래머스 - 문자열 내림차순으로 배치하기 (C++) (0) | 2020.03.05 |
프로그래머스 - 문자열 내 p와 y의 개수 (C++) (0) | 2020.03.05 |
프로그래머스 - 문자열 내 마음대로 정렬하기 (C++) (0) | 2020.03.05 |
댓글