chul's thinking
Chul n Ju
(281)
알쓸신잡
(4)
Short Thinking
(92)
Coding
(53)
CodeUp
(39)
Python
(14)
Chul's Family 09'
(0)
Chul
(0)
Kyung-Ju
(0)
Ju-Won
(0)
Camera_Lecture
(27)
Camera_Wants
(9)
Work
(32)
GSM
(1)
WCDMA
(3)
Embedded
(23)
Clien
(37)
New
(16)
Info
(1)
Magazine
(0)
혈액형
(0)
Spec
(2)
Info
(4)
food
(0)
engadget
(0)
Etc.
(0)
Life
(3)
Util
(1)
Music
(0)
Funny
(0)
Photo_Chul n Ju 08'
(0)
Chul
(0)
Ju
(0)
Photo_Wedding
(0)
Travel
(0)
Chul n Ju 08'
(0)
Paris
(0)
Praha
(0)
Wien
(0)
Salsbrug
(0)
Muchen
(0)
Amsteldam
(0)
Photo_
(0)
200708_Tailand
(0)
200801_SerkYoung Wedding
(0)
200803_Guam
(0)
Family
(0)
Company
(0)
Etc.
(0)
Photo_Camera
(0)
Barnak IIIf
(0)
Pentax Me Super
(0)
Contax G1
(0)
Pentax MX
(0)
Short_Articles
(12)
HOME
TAG
MEDIA LOG
LOCATION LOG
GUEST BOOK
ADMIN
WRITE
=3=3=3ㅌㅌ
simix.net 에 오신걸 환영 합니다..^^
/
/
블로그 내 검색
Coding/CodeUp
1915 : (재귀함수) 피보나치 수열
2023.03.15
1912 : (재귀함수) 팩토리얼 계산
2023.03.15
1905 : (재귀함수) 1부터 n까지 합 구하기
2023.03.15
1904 : (재귀함수) 두 수 사이의 홀수 출력하기
2023.03.15
1902 : (재귀 함수) 1부터 n까지 역순으로 출력하기 해결
2023.03.15
1901 : (재귀 함수) 1부터 n까지 출력하기
2023.03.15
1915 : (재귀함수) 피보나치 수열
chulpark
2023. 3. 15. 18:32
2023. 3. 15. 18:32
https://codeup.kr/problem.php?id=1915
여기서 포인트는 n번째를 거꾸로 Tracking 하는 것임
import sys
sys.setrecursionlimit(10**7)
a = int(input())
def fib(n):
if n == 0:
return 0
elif n == 1 or n == 2:
return 1
else:
return fib(n - 1) + fib(n - 2)
print(fib(a))
공유하기
게시글 관리
chul's thinking
저작자표시
1912 : (재귀함수) 팩토리얼 계산
chulpark
2023. 3. 15. 18:31
2023. 3. 15. 18:31
https://codeup.kr/problemsetsol.php?psid=21
import sys
sys.setrecursionlimit(10**7)
n = int(input())
def add_ft(a, sum):
if a < n+1 :
sum = sum * a
return add_ft(a + 1, sum)
else:
return sum
print(add_ft(2, 1))
공유하기
게시글 관리
chul's thinking
저작자표시
1905 : (재귀함수) 1부터 n까지 합 구하기
chulpark
2023. 3. 15. 18:31
2023. 3. 15. 18:31
https://codeup.kr/problem.php?id=1905
아래 포인트는
RecursionError: maximum recursion depth exceeded in comparison 를 출력함의 문제이다
전체 재귀함수의 크기를 늘려주면 된다!!
import sys
sys.setrecursionlimit(10**7)
n = int(input())
sum = 0
def add_ft(n, su):
if n > 0:
su = su + n
return add_ft(n - 1, su)
else:
return su
print(add_ft(n, 0))
공유하기
게시글 관리
chul's thinking
저작자표시
1904 : (재귀함수) 두 수 사이의 홀수 출력하기
chulpark
2023. 3. 15. 18:30
2023. 3. 15. 18:30
https://codeup.kr/problem.php?id=1904
주의 사항은
연속된 print를 연결로 할 경우, print(s, end=' ')로 해결한다.
st, ed = map(int, input().split())
def add_ft(s,e):
if s<=e:
if s%2==1:
print(s, end=' ')
return add_ft(s+1,e)
else:
return add_ft(s+1,e)
add_ft(st, ed)
공유하기
게시글 관리
chul's thinking
1902 : (재귀 함수) 1부터 n까지 역순으로 출력하기 해결
chulpark
2023. 3. 15. 18:30
2023. 3. 15. 18:30
https://codeup.kr/problem.php?id=1902
n=int(input())
def add_ft(a):
if a > 0:
print(a)
return add_ft(a-1)
else:
pass
add_ft(n)
공유하기
게시글 관리
chul's thinking
1901 : (재귀 함수) 1부터 n까지 출력하기
chulpark
2023. 3. 15. 18:29
2023. 3. 15. 18:29
https://codeup.kr/problem.php?id=1901
add_ft을 0부터 시작하면 안됨
n=int(input())
def add_ft(a):
if a < n+1:
print(a)
return add_ft(a+1)
else:
pass
add_ft(1)
공유하기
게시글 관리
chul's thinking
PREV
이전
1
···
3
4
5
6
7
NEXT
다음
+ Recent posts
Powered by
Tistory
, Designed by
wallel
Rss Feed
and
Twitter
,
Facebook
,
Youtube
,
Google+
티스토리툴바