자료구조

    [class4] (백준 9935) 문자열 폭발

    알고리즘 자료구조, 문자열, 스택 문자열을 스택처럼 pop_back 연산하여 풀었습니다. [문제 본문] 더보기 HTML 삽입 미리보기할 수 없는 소스 [푼 코드] #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(); cout.tie(); string str, bomb, result = ""; cin >> str; cin >> bomb; int bombNum = bomb.length() - 1; for (int i = 0; i < str.length(); i++) { result += str[i]; if (result[result.length() - 1] == bomb[bombNum]) { if ..

    [class6] (백준 14725) 개미굴

    HTML 삽입 미리보기할 수 없는 소스 #include #include using namespace std; struct Node { int depth = 0; map m; }; int N; string ChangeStr(string str,int count) { string temp = ""; while (count-- > 1) { temp += "--"; } return temp + str; } Node* AddTree(Node* root, string str, int count) { str = ChangeStr(str, count); if (root->m.find(str) != root->m.end()) { return root->m[str]; } Node* node = new Node(); nod..