분류 전체보기

    [class4] (백준 1043) 거짓말

    HTML 삽입 미리보기할 수 없는 소스 #include #include #include #define MAXNUM 51 using namespace std; struct PartyPeople { int num; int people[MAXNUM] = {0}; }; int n, m; int knownNum; int result = 0; set knownPeople; vector v; bool CheckAble(PartyPeople pp) { for (auto iter = knownPeople.begin(); iter != knownPeople.end(); iter++) { for (int i = 0; i < pp.num; i++) { if (*iter == pp.people[i]) { return false..

    [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..

    [다시풀기] (백준 12851) 숨바꼭질 2

    [다시풀기] (백준 12851) 숨바꼭질 2

    HTML 삽입 미리보기할 수 없는 소스 #include #include #define MAXNUM 100001 using namespace std; struct Info { int x; int time = 0; }; int N, K; int minTime = 0; int findWay = 0; queue q; bool visit[MAXNUM] = { false }; bool IsRange(int num) { if (num >= 0 && num < MAXNUM) { return true; } return false; } void BFS(int start) { q.push({ start,0 }); while (!q.empty()) { Info temp = q.front(); q.pop(); visit[tem..

    [class4] (백준 2638) 치즈

    HTML 삽입 미리보기할 수 없는 소스 #include #include #include using namespace std; #define MAXNUM 101 struct Pos { int x; int y; }; int arr[MAXNUM][MAXNUM]; int visit[MAXNUM][MAXNUM] = { false }; int countAir[MAXNUM][MAXNUM]; int dx[4] = { 1, -1, 0, 0 }; int dy[4] = { 0, 0, 1, -1 }; int n, m; int result = 0; queue q1; queue q2; vector v; bool IsRange(Pos pos) { if (pos.x >= 1 && pos.y >= 1 && pos.x n >> m; f..

    [class4] (백준 17070) 파이프 옮기기 1

    HTML 삽입 미리보기할 수 없는 소스 #include #include using namespace std; int arr[33][33]; int n; int result = 0; enum currentPipe { a, b, c }; struct Pipe { int x; int y; currentPipe _currentPipe; }; bool isAble(int x, int y, currentPipe way) { if (way == a) { if (arr[y][x + 1]) { return false; } } else if (way == b) { if (arr[y][x + 1] || arr[y + 1][x + 1] || arr[y + 1][x]) { return false; } } else { if (a..

    [class4] (백준 15686) 치킨 배달

    HTML 삽입 미리보기할 수 없는 소스 #include #include using namespace std; int n, m; int arr[51][51]; vector chicken; vector house; pair choiceChicken[13]; int minNum = 50 * 2 * 50; int CalRange(pair a, pair b) { int gap = (a.first > b.first) ? a.first - b.first : b.first - a.first; gap += (a.second > b.second) ? a.second - b.second : b.second - a.second; return gap; } void CalChickenRange() { int sum = 0; fo..