백준 알고리즘/수학21 백준 1003번 파이썬 def fibonacci(n): count_0=[1,0,1] count_1=[0,1,1] if n==0 or n==1: print(count_0[n],count_1[n]) else: for i in range(3,n+1): count_0.append(count_0[i-1]+count_0[i-2]) count_1.append(count_1[i-1]+count_1[i-2]) print(count_0[n],count_1[n])for i in range(int(input())): fibonacci(int(input())) 2018. 9. 24. 백준 2749 파이썬 mod = 1000000p = mod//10*15num = int(input())list = [0,1]for i in range(2,p): list.append(list[i-1]+list[i-2]) list[i] = list[i]%modprint(list[num%p]) 2018. 9. 24. 백준 2747 파이썬 i=int(input())list=[0]*(i+2)list[1]=1for i in range(2,i+2): list[i] = list[i-1]+list[i-2]print(list[i-1]) 2018. 9. 24. 백준 2747 파이썬 i=int(input())list=[0]*(i+2)list[1]=1for i in range(2,i+2): list[i] = list[i-1]+list[i-2]print(list[i-1]) 2018. 9. 24. 이전 1 2 3 4 5 6 다음