level2

    [2] 오픈 채팅방

    vector OpenChat(vector record) { vector answer, state; map user; for (int i = 0; i > token) str[index++] = token; if (str[0] == "Enter") { state.push_back("님이 들어왔습니다."); answer.push_back(str[1]); user[str[1]] = str[2]; } else if (str[0] == "Leave") { state.push_back("님이 나갔습니다."); answer.pus..

    [2] 이진 변환 반복하기

    vector BinaryCode(string s) { vector answer(2, 0); int zeroCount = 0, round = 0; while (s != "1") { string tmpStr = ""; int size = 0, num; round++; for (int i = 0; i 0) { s += to_string(num % 2); num /= 2; } } answer[0] = round; answer[1] = zeroCount; return answer; }