728x90 Split2 [programmers] Lv.2 튜플(c++) 간단하게 끝낼 수 있는것은 간단하게 해결하자!! 는 생각이었다. 더보기 #include #include #include using namespace std; vector split(string str){ smatch match; vector res; while(regex_search(str, match, regex("(\\d|,)+"))){ string matched = match.str(); str = match.suffix().str(); str = str.substr(2); smatch number; vector inside; while(regex_search(matched, number, regex("\\d+"))){ inside.push_back(stoi(number.str())); matche.. 2022. 5. 4. [programmers] Lv.2 오픈채팅방(c++) 흠.. 너무 빨리 푼거같다. 담엔 Level3를 도전해봐야겠다.(일기) 더보기 #include using namespace std; vector solution(vector record) { vector answer; map id_nickname; // id 별 닉네임 관리 queue enter_leave; // enter/leave, id가 순서대로 들어감 for(string r: record){ istringstream iss(r); string op, id, nickname; iss >> op >> id >> nickname; // spilt if(op == "Enter" || op == "Change") id_nickname[id] = nickname; if(op == "Enter" || op =.. 2022. 4. 18. 이전 1 다음 728x90