전체 글

IT Blog
https://www.acmicpc.net/problem/4358 4358번: 생태학 프로그램은 여러 줄로 이루어져 있으며, 한 줄에 하나의 나무 종 이름이 주어진다. 어떤 종 이름도 30글자를 넘지 않으며, 입력에는 최대 10,000개의 종이 주어지고 최대 1,000,000그루의 나무가 주어 www.acmicpc.net #include #include #include #include using namespace std; int main() { int i = 0; map m; char tree[31]; int ch = 0; int k = 0; while (!cin.eof()) { cin.getline(tree, 31, '\n'); k++; if (m.find(tree) == m.end()) { m.ins..
https://www.acmicpc.net/problem/2002 2002번: 추월 입력은 총 2N+1개의 줄로 이루어져 있다. 첫 줄에는 차의 대수 N(1 ≤ N ≤ 1,000)이 주어진다. 둘째 줄부터 N개의 줄에는 대근이가 적은 차량 번호 목록이 주어지고, N+2째 줄부터 N개의 줄에는 영식이 www.acmicpc.net #include #include #include typedef enum { false, true } bool; int cnt = 0; typedef struct _Node { char carNum[9]; struct _Node* next; }Node; typedef struct { Node* head; int len; Node* tail; }LinkedList; bool IsEmp..
https://www.acmicpc.net/problem/9934 #include #include #include int main() { int arr[1024] = {0}; int H, cnt; int parr[11][1024] = {0}; int N; int num; scanf("%d", &H); num =(int)pow(2, H); cnt = num - 1; for (int i = 0; i 0) { for (int j = 0; j < pow(2, H) - 1; j++) { if (j % 2 == 0) parr[H][j] = arr[j]..
2220번: 힙 정렬 힙은 자료의 추가, 우선순위가 제일 높은 자료의 삭제가 가능한 자료구조이다. 이와 같은 힙에는 두 종류가 있는데, 각각 최소-힙, 최대-힙이다. 이 문제에서는 최대-힙을 다루기로 하자. 이와 같 www.acmicpc.net https://www.acmicpc.net/problem/2220 #include int main() { int arr[100000] = {0}; int N, idx, tmp, size, numOfData; arr[1] = 1; numOfData = 1; scanf(" %d", &N); idx = 1; for(int i= 2; i arr[idx / 2]) { arr[idx] = arr[idx / 2]; idx = idx / 2; } else break; } arr..
https://www.acmicpc.net/problem/1599 #include #include #include int cmp(const char* s1, const char* s2) { char c1, c2; while (1) { /* s1, s2 문자열에서 순서대로 한글자씩 가져옵니다. */ c1 = *s1++; c2 = *s2++; /* 한글자씩 비교하고 다르면 -1 또는 1 리턴합니다. */ if (c1 == '\0') { return -1; } else if (c2 == '\0') { return 1; } if (c1 == 'k') { if (c2 == 'k') continue; // 만약c2와 c1 둘 다 k라면 비교할 필요가 없음. if (c2 = 'o') return 1; else ret..
밤밭황제
밤밭