Stack
Introduction
재귀함수를 다뤄 봅시다.
Example
https://www.acmicpc.net/step/19
재귀함수가 뭔가요?
재귀함수를 배우면서 재귀함수를 배우는 문제
import sys
input = sys . stdin . readline
N = int ( input ())
def recursion ( cnt , n ):
print ( "____" * cnt + '"재귀함수가 뭔가요?"' )
if cnt == n :
print ( "____" * cnt + '"재귀함수는 자기 자신을 호출하는 함수라네"' )
else :
print ( "____" * cnt + '"잘 들어보게. 옛날옛날 한 산 꼭대기에 이세상 모든 지식을 통달한 선인이 있었어.' )
print ( "____" * cnt + '마을 사람들은 모두 그 선인에게 수많은 질문을 했고, 모두 지혜롭게 대답해 주었지.' )
print ( "____" * cnt + '그의 답은 대부분 옳았다고 하네. 그런데 어느 날, 그 선인에게 한 선비가 찾아와서 물었어."' )
recursion ( cnt + 1 , n )
print ( "____" * cnt + "라고 답변하였지." )
print ( "어느 한 컴퓨터공학과 학생이 유명한 교수님을 찾아가 물었다." )
recursion ( 0 , N )
재귀의 귀재
import sys
input = sys . stdin . readline
cnt = 0
def recursion ( s , l , r ):
global cnt
cnt += 1
if l >= r : return 1
elif s [ l ] != s [ r ]: return 0
else : return recursion ( s , l + 1 , r - 1 )
def isPalindrome ( s ):
return recursion ( s , 0 , len ( s ) - 1 )
T = int ( input ())
for _ in range ( T ):
string = input (). rstrip ( " \n " )
cnt = 0
print ( isPalindrome ( string ), cnt )
병합정렬
별 찍기 - 10
재귀적인 패턴을 재귀함수로 찍는 문제
## star(3) 3x3
## star(9) 9x9
# star(3), star(3), star(3)
# star(3), X , star(3)
# star(3), star(3), star(3)
## star(27) 27x27
# star(9), star(9), star(9)
# star(9), X , star(9)
# star(9), star(9), star(9)
하노이탑 이동 순서
재귀적인 패턴을 찾아서 재귀함수로 찍는 문제
Please enable JavaScript to view the comments powered by Disqus.
2022
2 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
3 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
1 minute read
Introduction
3 minute read
1167 트리의 지름
3 minute read
Introduction
1 minute read
Introduction
2 minute read
Introduction
less than 1 minute read
Introduction
4 minute read
Introduction
less than 1 minute read
Introduction
6 minute read
Introduction
2 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Introduction
3 minute read
Introduction
2 minute read
Introduction
2 minute read
Introduction
3 minute read
Introduction
less than 1 minute read
Git 명령어를 사용한 하위 디렉토리 다운로드
Clone 할 로컬 저장소 생성
1 minute read
Introduction
less than 1 minute read
# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin
less than 1 minute read
Introduction
less than 1 minute read
Introduction
3 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
3 minute read
Introduction
less than 1 minute read
Introduction
4 minute read
Introduction
less than 1 minute read
Introduction
less than 1 minute read
Introduction
2 minute read
Introduction
less than 1 minute read
Introduction
1 minute read
Introduction
less than 1 minute read
Spring Project
less than 1 minute read
the page for java
3 minute read
가벼운 Base image를 사용
less than 1 minute read
version: 3.0.0a10
less than 1 minute read
WIDTH
less than 1 minute read
version: 3.0.0a10
less than 1 minute read
#include <iostream>
#include <thread>
#include <chrono>
#include <mutex>
#include <atomic>
#include <string.h>
1 minute read
version: 3.0.0a10
less than 1 minute read
https://cplusplus.com/reference/future/
less than 1 minute read
Multithreading support was introduced in C++11.
less than 1 minute read
how to costom github blog using jekyll
less than 1 minute read
You’ll find this post in your _posts directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different wa...
Back to top ↑