프로그래머스 입력이 좀 생소해서 나중에 참고할 입력 코드임
입력예시
[1,2,3,4,5,6,7...]
--
참고 코드
for (int i = 0; i < Len; i++)
{
char buf[1000]; int buf_Idx = 0;
while (!(str[i] == '[' || str[i] == ',' || str[i] == ' ' || str[i] == ']'))
{
if(isdigit(str[i]))
buf[buf_Idx++] = str[i++];
}
buf[buf_Idx] = '\0';
if (buf[0] != '\0')
{
V.push_back(atoi(buf));
}
/*
if (str[i] == ']')
bIsProg = false;
*/
}
--
'컴퓨터 > 알고리즘' 카테고리의 다른 글
[프로그래머스 스택/큐] (level2) 2번 - 프린터 (0) | 2021.06.29 |
---|---|
[프로그래머스 스택/큐] (level2) 1번 - 기능개발 (0) | 2021.06.28 |
[백준 10828번] 스택 - 1차 스터디 A (0) | 2021.06.25 |
[백준 10942번] 팰린드롬 |오토마타|,|DP연습| (0) | 2021.02.24 |
|정렬 알고리즘|버블, 선택, 삽입, 퀵, 병합, 힙 정렬 연습 (0) | 2021.02.10 |