From 1e1a687355a7526ab7eabcebc04c0eb93dad69cc Mon Sep 17 00:00:00 2001 From: yenru0 Date: Tue, 21 Apr 2020 12:52:50 +0900 Subject: [PATCH] =?UTF-8?q?20200421=203=EB=AC=B8=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2447 11729 2447_loop (add 뭔가 2447이 이상함 다시 풀어야겠음) --- zeta_python/2447.py | 51 ---------------------------------- zeta_python/2447_loop.py | 0 zeta_python/completed/11729.py | 14 ++++++++++ zeta_python/completed/2447.py | 19 +++++++++++++ zeta_python/stdin.txt | 1 + 5 files changed, 34 insertions(+), 51 deletions(-) delete mode 100644 zeta_python/2447.py create mode 100644 zeta_python/2447_loop.py create mode 100644 zeta_python/completed/11729.py create mode 100644 zeta_python/completed/2447.py diff --git a/zeta_python/2447.py b/zeta_python/2447.py deleted file mode 100644 index 14d459c..0000000 --- a/zeta_python/2447.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -2447: 별 찍기 - 10 -문제: - 예제를 보고 규칙을 유추한 뒤에 별을 찍어 보세요. -입력: - 첫째 줄에 N이 주어진다. N은 항상 3의 제곱꼴인 수이다. (3, 9, 27, ...) (N=3^k, 1 ≤ k < 8) -출력: - 첫째 줄부터 N번째 줄까지 별을 출력한다. -""" -""" -TC1: -Input: -27 -Output: -*************************** -* ** ** ** ** ** ** ** ** * -*************************** -*** ****** ****** *** -* * * ** * * ** * * * -*** ****** ****** *** -*************************** -* ** ** ** ** ** ** ** ** * -*************************** -********* ********* -* ** ** * * ** ** * -********* ********* -*** *** *** *** -* * * * * * * * -*** *** *** *** -********* ********* -* ** ** * * ** ** * -********* ********* -*************************** -* ** ** ** ** ** ** ** ** * -*************************** -*** ****** ****** *** -* * * ** * * ** * * * -*** ****** ****** *** -*************************** -* ** ** ** ** ** ** ** ** * -*************************** -""" -s = [] -def B(n): - if n == 1: - return "*" - else : - s.append([B(int(n/3))+B(int(n/3))+B(int(n/3)) - B(int(n/3))+" "*int(n/3)+B(int(n/3)) - B(int(n/3))+B(int(n/3)),B(int(n/3)) -B(3) \ No newline at end of file diff --git a/zeta_python/2447_loop.py b/zeta_python/2447_loop.py new file mode 100644 index 0000000..e69de29 diff --git a/zeta_python/completed/11729.py b/zeta_python/completed/11729.py new file mode 100644 index 0000000..d5b9766 --- /dev/null +++ b/zeta_python/completed/11729.py @@ -0,0 +1,14 @@ +N = int(input()) +def move(f, t): + print(f, t) + +def hanoi(n, f, b, t): + if n == 1: + move(f, t) + else: + hanoi(n-1, f, t, b) + move(f, t) + hanoi(n-1, b, f, t) + +print(2**N-1) +hanoi(N, 1,2,3) \ No newline at end of file diff --git a/zeta_python/completed/2447.py b/zeta_python/completed/2447.py new file mode 100644 index 0000000..580525e --- /dev/null +++ b/zeta_python/completed/2447.py @@ -0,0 +1,19 @@ +N = int(input()) + +A = ([" "] * N + ["\n"]) * N + +def B(n, x, y): + global A + if n == 0: + A[(N+1)*y+x] = "*" + return + c = n//3 + for i in range(3): + for j in range(3): + if i == 1 and j == 1: + continue + B(c, x+c*i, y+c*j) + +B(N, 0, 0) +for i in A: + print(i, end="") diff --git a/zeta_python/stdin.txt b/zeta_python/stdin.txt index e69de29..56a6051 100644 --- a/zeta_python/stdin.txt +++ b/zeta_python/stdin.txt @@ -0,0 +1 @@ +1 \ No newline at end of file