Complete Tree Labeling http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=1125&sca=99&page=9 JUNGOL www.jungol.co.kr 문제풀이 >완전 트리의 depth와 k(분기계수)가 주어졌을 때 오름차순으로 트리가 존재할 수 있는 경우의 수를 구한다. 배울점 >완전트리는 대칭으로 구현되므로 일정 모양에서는 순열과 조합문제로 바뀐다. >점화식을 찾는게 핵심 소스>미구현 ACM준비/기타 2015.01.08
Self-describing Sequence 문제풀이 >특수한 f(x) 함수에서 규칙을 찾아내어 f(n)을 구한다. >함수의 규칙을 찾아내어 간단히 구현하는게 중요 배울점 >f(1)+..+f(n)의 값을 k라 한다면 f(k)는 n이다. >f(n)을 계산하기 위해서는 위 f(1)+..+f(x)의 값을 넘지않는 x을 찾는다. 소스>성공 #include int map[200][200]; int color[200]; int queue[40000]; int top, bot; int main() { int n, l, i, j, x, y, root; while (scanf("%d", &n), n != 0) { for (i = 0; i < n; i++) { // -1 not input, 1 on, 0 off//init color[i] = -1; for (j = .. ACM준비/기타 2015.01.08
Reverse and Add 문제풀이 >기존 숫자와 뒤집은 숫자를 합하여 결국 앞뒤가 구분없는 숫자를 만드는게 목표(ex 98789) >최대크기를 고려하는게 중요 배울점 >기존의 int를 넘는 unsigned int 또는 long을 사용함으로써 해결을 할 수 있다. >reverse함수에서 간단한 산술연산으로 구할 수 있다. 소스>성공 #include unsigned int reverse(unsigned int n) { unsigned int n2 = 0; while (n) { n2 = (n2 * 10) + (n % 10); n /= 10; } return n2; } int main() { int Case, count; unsigned int n, n2; scanf("%d", &Case); while (Case--) { scanf(".. ACM준비/기타 2015.01.08
Stacks of Flapjacks https://onlinejudge.org/index.php?option=onlinejudge&Itemid=8&page=show_problem&problem=56 Online Judge Our Patreons Diamond Sponsors Steven & Felix Halim Reinardus Pradhitya Gold Sponsors --- YOUR NAME HERE ---- Silver Sponsors --- YOUR NAME HERE ---- Bronze Sponsors Christianto Handojo Krzysztof Adamek Fatima Broom Amal Augustine Contribute Bitcoin onlinejudge.org 문제풀이 >팬케이크를 올림차순으로 재 정렬하는게 목표.. ACM준비/기타 2015.01.08
Where's Waldorf? https://www.acmicpc.net/problem/6983 6983번: Where's Waldorf? The input begins with a number on a line by itself, indicating the number of test cases that follow. Each test case consists of a pair of integers, m followed by n, 1 ≤ m ≤ 50 and 1 ≤ n ≤ 50 in decimal notation on a single line. The next m lines co www.acmicpc.net 문제풀이 >문자열을 입력받아 미리 입력된 문자판에서 찾기(낱말찾기와 유사) >문자판에서 해당되는 문자를 검색하고 찾은 후에는 전체.. ACM준비/acmicpc 2015.01.08
TheArcheologist'sDilemma https://onlinejudge.org/external/7/701.pdf #include #include int len; char map[50][50]; char string[50]; int check(int s, int t, int x, int y) { int l = 1; while (len > l) { x += s; y += t; if (x > 50 || x 50 || y < 0) return 0; if (map[x][y] == string[l++]) ; else return 0; } return 1; } char change(char c) { if (c = len) if (check(-1, 0, x, y)) { sucess = 1; break; } if (check(-1, 1.. ACM준비/기타 2015.01.08