s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s340959378
p02233
u432133312
1586346340
Python
Python3
py
Accepted
20
5604
213
def fib(n): memo = [0 for _ in range(n+1)] memo[0] = 1 memo[1] = 1 for i in range(n-1): memo[i+2] = memo[i+1] + memo[i] return memo[n] n = int(input()) print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,382
s709036502
p02233
u067972379
1586185800
Python
Python3
py
Accepted
20
5600
121
N = int(input()) dp = [0] * (N + 1) dp[0] = dp[1] = 1 for i in range(2, N+1): dp[i] = dp[i-1] + dp[i-2] print(dp[N])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,383
s289327145
p02233
u698024824
1586100185
Python
Python3
py
Accepted
20
5600
321
class Fib: def __init__(self): self.memo = {0: 1, 1: 1} def calc_fib(self, n): if n in self.memo.keys(): return self.memo[n] self.memo[n] = self.calc_fib(n - 2) + self.calc_fib(n - 1) return self.memo[n] fib = Fib() print(fib.calc_fib(int(input())))...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,384
s725475675
p02233
u344362704
1586075541
Python
Python3
py
Accepted
20
5600
121
n = int(input()) fib = [1, 1, 2] for i in range(3, n+1): tmp = fib[i-1] + fib[-2] fib.append(tmp) print(fib[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,385
s259620822
p02233
u740184621
1586072640
Python
Python3
py
Accepted
20
5604
272
def fib_memo(n): memo = [0] * (n + 1) def _fib(n): if n <= 1: return 1 if memo[n] != 0: return memo[n] memo[n] = _fib(n-1) + _fib(n-2) return memo[n] return _fib(n) N = int(input()) print(fib_memo(N))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,386
s700224049
p02233
u622912304
1585981346
Python
Python3
py
Accepted
20
5600
296
# https://onlinejudge.u-aizu.ac.jp/problems/ALDS1_10_A if __name__ == "__main__": n = int(input()) if n == 0 or n == 1: result = 1 else: A = [1] * (n + 1) for i in range(2, n+1): A[i] = A[i-1] + A[i-2] result = A[n] print(result)
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,387
s073888458
p02233
u076951214
1585901743
Python
Python3
py
Accepted
20
5600
125
n=int(input()) fib=[0 for _ in range(45)] fib[0]=1 fib[1]=1 for i in range(2,45): fib[i]=fib[i-1]+fib[i-2] print(fib[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,388
s193951201
p02233
u341188593
1585797029
Python
Python3
py
Accepted
20
5600
97
n=int(input()) L=[0]*(n+1) L[0]=1 L[1]=1 for i in range(n-1): L[i+2]=L[i+1]+L[i] print(L[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,389
s125988924
p02233
u037820925
1585741925
Python
Python3
py
Accepted
20
5600
113
n = int(input()) f = [0]*45 f[0] = 1 f[1] = 1 for i in range(2,45): f[i] = f[i-1] + f[i-2] print(f[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,390
s283101882
p02233
u737337423
1585718028
Python
Python3
py
Accepted
20
6248
229
MAX = 10**5 fib = [0]*MAX def fibonacci(n): if fib[n]: return fib[n] if n == 0 or n == 1: return 1 fib[n] = fibonacci(n-1)+fibonacci(n-2) return fib[n] N = int(input()) print(fibonacci(N))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,391
s091408466
p02233
u951319620
1585669005
Python
Python3
py
Accepted
50
9008
592
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time from collections import deque sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().rstrip() # ign...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,392
s744813451
p02233
u665008200
1585666165
Python
Python3
py
Accepted
20
5604
307
import sys input = sys.stdin.readline def inpl(): return list(map(int, input().split())) def f(n): if n < 2: return 1 ret = [0] * (n + 1) ret[0] = 1 ret[1] = 1 for i in range(2, n + 1): ret[i] = ret[i - 2] + ret[i - 1] return ret[n] print(f(int(input())))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,393
s629476922
p02233
u838900850
1585664529
Python
Python3
py
Accepted
20
5600
221
def main(): size = 45 fib = [0]*size fib[0] = 1 fib[1] = 1 for i in range(2,size): fib[i] = fib[i-1]+fib[i-2] n = int(input()) print (fib[n]) if __name__ == '__main__': main()
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,394
s645612586
p02233
u870171689
1585639220
Python
Python3
py
Accepted
20
5600
310
#!/usr/bin/env python3 n = int(input()) # TLE # def fib(n): # if n == 0: # return 1 # elif n == 1: # return 1 # else: # return fib(n - 1) + fib(n - 2) # print(fib(n)) dp = {} dp[0] = 1 dp[1] = 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] print(dp[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,395
s113642539
p02233
u891183253
1585540650
Python
Python3
py
Accepted
20
5632
492
def resolve(): ''' code here ''' import sys sys.setrecursionlimit(100000000) N = int(input()) memo = [0 for _ in range(N+1)] def fina(n): if n <= 1: memo[n] = 1 return 1 if memo[n] != 0: return memo[n] memo[n-1] = fina(n-1)...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,396
s496812214
p02233
u557098739
1585471030
Python
Python3
py
Accepted
20
5596
407
n = int(input()) dp = [-1] * (n+1) # def fibonacci(n): # if n==0 or n==1: # dp[n] = 1 # return dp[n] # else: # if dp[n]!=-1: # return dp[n] # else: # dp[n] = fibonacci(n-1) + fibonacci(n-2) # return dp[n] # ans = fibonacci(n) # print(ans) d...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,397
s226000407
p02233
u610816226
1585390767
Python
Python3
py
Accepted
30
5596
121
n = int(input())+1 dp = [1]*n for i in range(n): if i<2: continue dp[i] = dp[i-1]+dp[i-2] print(dp[n-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,398
s486746413
p02233
u009853378
1585369518
Python
Python3
py
Accepted
20
5600
125
ii = lambda : int(input()) n = ii() w = [-1]*50 w[0] = 1 w[1] = 1 for i in range(2,45): w[i]=w[i-2] + w[i-1] print(w[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,399
s095025582
p02233
u760323727
1585368673
Python
Python3
py
Accepted
20
5600
222
n= int(input()) if n <= 1: print(1) exit() fib_ = [0]*(n+1) fib_[0] = 1 fib_[1] = 1 def fib(n): if fib_[n] >= 1: return fib_[n] else: fib_[n] = fib(n-1)+fib(n-2) return fib(n-1)+fib(n-2) print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,400
s034065631
p02233
u176870835
1585344865
Python
Python3
py
Accepted
20
5604
203
import sys sys.setrecursionlimit(15000) n = int(input()) memo = {0:1,1:1} def fib(n): if n < 2: return memo[n] if not n in memo: memo[n] = fib(n-1)+fib(n-2) return memo[n] print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,401
s859068899
p02233
u787764999
1585311610
Python
Python3
py
Accepted
20
5600
125
n = int(input()) A = [0 for _ in range(n+1)] A[0] = A[1] = 1 for i in range(2, n+1): A[i] = A[i-1] + A[i-2] print(A[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,402
s466029128
p02233
u560613143
1585310880
Python
Python3
py
Accepted
20
5600
137
n=int(input()) dp=[0]*(n+1) for i in range(n+1): if i<=1: dp[i]=1 continue dp[i]=dp[i-1]+dp[i-2] print(dp[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,403
s359442683
p02233
u805852387
1585302198
Python
Python3
py
Accepted
20
5600
195
memo=[0]*50 def fib(n): if memo[n]>0: return memo[n] if n<=1: memo[n]=1 return 1 memo[n]=fib(n-1)+fib(n-2) return memo[n] n = int(input()) print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,404
s374960969
p02233
u260266858
1585125258
Python
Python3
py
Accepted
20
5600
207
n = int(input()) dp = [-1] * (n+1) dp[0] = 1 if n >= 1: dp[1] = 1 def fib(i): if dp[i] > 0: return dp[i] else: dp[i] = fib(i-1) + fib(i-2) return dp[i] print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,405
s961974516
p02233
u388160563
1585112002
Python
Python3
py
Accepted
20
5608
165
#フィボナッチ数列 n = int(input()) dp = [0 for i in range(1000)] dp[0] = 1 dp[1] = 1 for i in range(2,n+1): dp[i] = dp[i-1] + dp[i -2] print(dp[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,406
s640588933
p02233
u129426023
1585058615
Python
Python3
py
Accepted
20
5612
370
# import bisect # from collections import Counter, deque # import copy # from fractions import gcd def resolve(): N=int(input()) # dp[i]はh[i]までにかかるコストの最小値 dp = [float('inf') for _ in range(N+1)] dp[0] = 1 dp[1]=1 for i in range(2,N+1): dp[i] = min(dp[i], dp[i - 1] + dp[i-2]) prin...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,407
s223838814
p02233
u597579159
1585028430
Python
Python3
py
Accepted
20
5600
218
n=int(input()) memo=[0]*47 def fibo(x): if x==0 or x==1: return 1 elif memo[x]!=0: return memo[x] else: tmp=fibo(x-1)+fibo(x-2) memo[x]=tmp return tmp print(fibo(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,408
s528910330
p02233
u920279959
1584936754
Python
Python3
py
Accepted
20
5600
132
n = int(input()) fib = [0]*(n+1) fib[0],fib[1] = 1, 1 for i in range(2, n+1): fib[i] = fib[i-1] + fib[i-2] print(fib[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,409
s806061926
p02233
u902441874
1584852017
Python
Python3
py
Accepted
20
5600
276
import sys #import numpy as np #sys.setrecursionlimit(10**6) #readline = sys.stdin.readline n = int(input()) l = [1,1] def f(i): global l if i <= 1: return 1 else: return l[i-1] + l[i-2] for i in range(2,n+1): l.append(f(i)) print(l[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,410
s636959697
p02233
u639594975
1584679097
Python
Python3
py
Accepted
20
5600
158
n = int(input()) fib = [0]*(n+1) for i in range(n+1): if i==0 or i==1: fib[i] = 1 else: fib[i] = fib[i-1] + fib[i-2] print(fib[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,411
s883764880
p02233
u799595944
1584657196
Python
Python3
py
Accepted
20
5600
127
n = int(input()) map = [0]*(n+1) map[0] = 1 map[1] = 1 for i in range(n-1): map[i+2] = map[i] + map[i+1] print(map[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,412
s834483899
p02233
u230072054
1584195148
Python
Python3
py
Accepted
30
6372
282
from collections import deque from enum import Enum import sys import math BIG_NUM = 2000000000 MOD = 1000000007 EPS = 0.000000001 table = [0] * 45 table[0] = 1 table[1] = 1 N = int(input()) for i in range(2,N+1): table[i] = table[i-1]+table[i-2] print("%d"%(table[N]))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,413
s776794081
p02233
u457728280
1584183421
Python
Python3
py
Accepted
20
5600
201
N = int(input()) dp = [0] * (N + 1) if N == 0: print(0) exit() if N == 1: print(1) exit() dp[0] = 1 dp[1] = 1 for i in range(2, N + 1): dp[i] = dp[i - 1] + dp[i - 2] print(dp[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,414
s390941552
p02233
u284842807
1584180776
Python
Python3
py
Accepted
20
5596
116
n = int(input()) fib = [1, 1] for i in range(2, n+1): a = fib[i-1] + fib[i-2] fib.append(a) print(fib[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,415
s873189113
p02233
u215884762
1584158280
Python
Python3
py
Accepted
20
5600
183
a=[0]*100 a[0]=1 a[1]=1 a[2]=1 def fib(n): if a[n]!=0: return(a[n]) elif a[n]==0: a[n]=(fib(n-1)+fib(n-2)) return(a[n]) x=int(input()) print(fib(x+1))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,416
s484072551
p02233
u217435805
1584139978
Python
Python3
py
Accepted
20
5600
335
def fib(n): global Fib if n <= 1: return 1 elif Fib[n] != -1: return Fib[n] else: return fib(n-1) + fib(n-2) def fib_eff(n): global Fib Fib[0] = 1 Fib[1] = 1 for i in range(2, n+1): Fib[i] = Fib[i-1] + Fib[i-2] n = int(input()) Fib = [-1] * 45 fib_eff(n)...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,417
s546513295
p02233
u942532706
1584008953
Python
Python3
py
Accepted
20
5604
174
# -*- coding: utf-8 -*- fib = [-1 for _ in range(50)] fib[0] = 1 fib[1] = 2 for n in range(2, 50): fib[n] = fib[n - 1] + fib[n - 2] N = int(input()) print(fib[N - 1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,418
s442923442
p02233
u899624451
1583930171
Python
Python3
py
Accepted
20
5600
133
N = int(input()) dp = [0] * (N + 1) dp[0] = 1 dp[1] = 1 for i in range(2, N + 1): dp[i] = dp[i - 1] + dp[i - 2] print(dp[N])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,419
s054650259
p02233
u655589806
1583854319
Python
Python3
py
Accepted
20
5600
95
N = int(input()) fib = [1,1] for i in range(50): fib.append(fib[-1]+fib[-2]) print(fib[N])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,420
s384005317
p02233
u497462803
1583738178
Python
Python3
py
Accepted
20
5600
228
if __name__ == '__main__': n = int(input()) ans = [1, 1, ] if n == 0 or n == 1: print(ans[n]) else: for i in range(2, n + 1): ans.append(ans[i - 2] + ans[i - 1]) print(ans[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,421
s978284050
p02233
u815830103
1583322322
Python
Python3
py
Accepted
20
5600
194
n = int(input()) def fib(n): Fib = [1,1] if n == 0 or n == 1: return Fib[n] for i in range(2,n+1): Fib.append(Fib[i-1] + Fib[i-2]) return Fib[n] print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,422
s060312524
p02233
u925219592
1583318265
Python
Python3
py
Accepted
20
5600
201
def fib(n): F = {} F[0], F[1] = 1, 1 if n == 1 or n == 0: return 1 for i in range(2, n+1): F[i] = F[i-1] + F[i-2] return F[n] n = int(input()) print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,423
s231172306
p02233
u327242612
1583210420
Python
Python3
py
Accepted
20
5604
187
if __name__ == '__main__': import sys input = sys.stdin.readline n = int(input()) F = [1]*50 for i in range(2, n+1): F[i] = F[i-1] + F[i-2] print(F[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,424
s404223789
p02233
u921537862
1583135109
Python
Python3
py
Accepted
20
5604
293
def main(): import sys input=sys.stdin.readline n=int(input()) if n==0 or n==1: print(1) return dp=[0]*(1+n) dp[0]=1 dp[1]=1 for i in range(n-1): dp[i+2]=dp[i+1]+dp[i] print(dp[-1]) if __name__=='__main__': main()
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,425
s593280996
p02233
u556798528
1583112340
Python
Python3
py
Accepted
20
5600
269
def make_fibonacchi(n: int): res = {} res[0] = 1 res[1] = 1 if n == 0 or n == 1: return 1 for i in range(2, n + 1): res[i] = res[i-1] + res[i-2] return res[n] n = int(input()) print(make_fibonacchi(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,426
s326941540
p02233
u802742860
1583060936
Python
Python3
py
Accepted
50
6896
479
import sys import math import fractions import itertools from collections import deque import copy import bisect MOD = 10 ** 9 + 7 INF = 10 ** 18 + 7 input = lambda: sys.stdin.readline().strip() fib_list = [-1 for _ in range(100)] def fib(n): if n == 0 or n == 1: return 1 else: if fib_list[n...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,427
s636343409
p02233
u007578272
1583036320
Python
Python3
py
Accepted
20
5600
106
n = int(input()) f = [1,1] for _ in range(n-1): f_next = f[-1]+f[-2] f.append(f_next) print(f[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,428
s761677826
p02233
u606940205
1583028741
Python
Python3
py
Accepted
20
5600
177
dp = [0]*100 dp[0] = 1 dp[1] = 1 def fib(n): if dp[n]!=0: return dp[n] else: dp[n] = fib(n-1) + fib(n-2) return dp[n] print(fib(int(input())))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,429
s333673809
p02233
u037175009
1582942842
Python
Python3
py
Accepted
20
5600
134
n = int(input()) p = [1,1] if n <= 1: print (1) exit (0) for i in range(2,n+1): p.append(p[i-2] + p[i-1]) print (p[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,430
s543551404
p02233
u830381874
1582920354
Python
Python3
py
Accepted
20
5600
142
n = int(input()) dp = [0] * (n + 1) dp[0] = 1 dp[1] = 1 for i in range(2, n + 1): dp[i] = dp[i - 1] + dp[i - 2] ans = dp[n] print(ans)
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,431
s188692505
p02233
u440554255
1582790138
Python
Python3
py
Accepted
20
5596
116
n = int(input()) fib = [1, 1] for i in range(2, n+1): fib.append(fib[i - 2] + fib[i - 1]) print(fib[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,432
s716109133
p02233
u588702034
1582605207
Python
Python3
py
Accepted
20
5600
119
N = int(input()) dp = [0] * (N+1) dp[0], dp[1] = 1,1 for i in range(2,N+1): dp[i] = dp[i-1] + dp[i-2] print(dp[N])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,433
s822370224
p02233
u279415026
1582605044
Python
Python3
py
Accepted
20
5644
177
n = int(input()) fib_memo = [0 for i in range(10000)] fib_memo[0] = 1 fib_memo[1] = 1 for i in range(2, n+1): fib_memo[i] = fib_memo[i-1] + fib_memo[i-2] print(fib_memo[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,434
s059481222
p02233
u854140782
1582347182
Python
Python3
py
Accepted
20
5600
127
n = int(input()) n_L = [0] * 45 n_L[0] = 1 n_L[1] = 1 for i in range(2,n+1): n_L[i] = n_L[i-1] + n_L[i-2] print(n_L[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,435
s511968679
p02233
u992758171
1582170687
Python
Python3
py
Accepted
20
5600
124
n = int(input()) dp = [0]*(n+1) dp[0] = 1 dp[1] = 1 for i in range(2, n+1, 1): dp[i] = dp[i-2] + dp[i-1] print(dp[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,436
s484850374
p02233
u705234550
1582096828
Python
Python3
py
Accepted
20
5600
185
n = int(input()) if n == 0 or n == 1: print(1) elif n == 2: print(2) else: f = [1,1] for i in range(2, n+1): g = int(f[i-1]) + int(f[i-2]) f.append(g) print(f.pop())
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,437
s229318493
p02233
u240839092
1581953969
Python
Python3
py
Accepted
20
5600
366
def get_fibonacci_number(n): if n < 2: return 1 if not fibonacci_numbers[str(n)]: fibonacci_numbers[str(n)] = get_fibonacci_number(n-1) + get_fibonacci_number(n-2) return fibonacci_numbers[str(n)] if __name__ == "__main__": n = int(input()) fibonacci_numbers = {str(i):None for i in ...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,438
s560938263
p02233
u670802622
1581423198
Python
Python3
py
Accepted
20
5600
143
# Fibonacci Number N = int(input()) dp = [-1] * (N+1) dp[0] = 1 dp[1] = 1 for i in range(2, N+1): dp[i] = dp[i-2] + dp[i-1] print(dp[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,439
s276348265
p02233
u220403312
1581174285
Python
Python3
py
Accepted
20
5596
348
# Algorithms and Data Structures 1 # Fibonacci Numbers # Name: Ryuya Asada # ID: s1260064 def fibonacci(n) -> int: a = 0 b = 1 c = 0 for i in range(1, n+1): c = a + b a = b b = c return c def main(): n = int(input()) print(fibonacci(n)) pass if __name__...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,440
s987885668
p02233
u002280517
1581137915
Python
Python3
py
Accepted
30
6248
235
a = int(input()) memo = [0]*100000 def fib(n): if n == 0 or n == 1: memo[n] =1 if memo[n] == 0: memo[n] = fib(n-2) + fib(n-1) return memo[n] else: return memo[n] print(fib(a))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,441
s737263716
p02233
u820842907
1581051665
Python
Python3
py
Accepted
20
5600
207
def fib(n): l = [0] * (n + 1) l[0] = 1 l[1] = 1 for i in range(2, n + 1): l[i] = l[i - 2] + l[i - 1] return l[n] def main(): n = int(input()) print(fib(n)) main()
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,442
s984324295
p02233
u573662673
1580282328
Python
Python3
py
Accepted
20
5600
203
n = int(input()) dp = {} def fibonacci(n): if n == 0 or n == 1: return 1 if n in dp: return dp[n] dp[n] = fibonacci(n-1) + fibonacci(n-2) return dp[n] print(fibonacci(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,443
s418836884
p02233
u698652225
1580224632
Python
Python3
py
Accepted
20
5600
411
def power(base,exp,op=lambda x,y:x*y,ie=1): res = ie while exp: if exp & 1: res = op(res,base) base = op(base,base) exp >>= 1 return res def fibonacci(n): I = [1,0,0,1] A = [1,1,1,0] mmul = lambda P,Q: [P[0]*Q[0]+P[1]*Q[2],P[0]*Q[1]+P[1]*Q[3],P[2]*Q[0]+P[3]*Q...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,444
s793010416
p02233
u457009180
1580052260
Python
Python3
py
Accepted
20
5604
225
N = int(input()) dp = [ -1 for x in range(50)] def fib(n): if n == 0 or n == 1: dp[n] = 1 return dp[n] if dp[n] != -1: return dp[n] dp[n] = fib(n-1)+fib(n-2) return dp[n] print(fib(N))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,445
s435235008
p02233
u369455271
1579501277
Python
Python3
py
Accepted
20
5600
107
res = [1, 1] n = int(input()) for i in range(n - 1): res.append(res[i] + res[i + 1]) print(res[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,446
s812671992
p02233
u853741520
1578625540
Python
Python3
py
Accepted
20
5600
127
n = int(input()) if n <= 1: print(1) exit() x = [1, 1] for i in range(n-1): x.append(x[-1]+x[-2]) print(x[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,447
s452402610
p02233
u319394183
1578297264
Python
Python3
py
Accepted
20
5612
356
""" ALDS1_10_A 簡単な動的計画法を使ってフィボナッチ数列を計算する """ def Fibo(num): List = [None]*45 for i in range(num+1): if i == 0: List[0] = 1 elif i == 1: List[1] = 1 else: List[i] = List[i-1]+List[i-2] return List n = int(input()) print(Fibo(n)[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,448
s138864251
p02233
u230220367
1577765943
Python
Python3
py
Accepted
20
5600
116
n = int(input()) f = [0] * (n+1) f[0] = 1 f[1] = 1 for i in range(2, n+1): f[i] = f[i-1] + f[i-2] print(f[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,449
s577862129
p02233
u167152630
1577513924
Python
Python3
py
Accepted
20
5600
317
MAX_N = 44 _memo = [None for _ in range(MAX_N + 1)] _memo [0] = _memo[1] = 1 def fibonacci(n): if _memo[n] is not None: return _memo[n] else: _memo[n] = fibonacci(n - 1) + fibonacci(n - 2) return _memo[n] if __name__ == '__main__': n = int(input()) print(fibonacci(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,450
s742822541
p02233
u194126754
1577397602
Python
Python3
py
Accepted
20
5600
167
n = int(input()) # dpテーブルの用意 dp = [-1]*(n+1) # dpの初期値 dp[0], dp[1] = 1, 1 for i in range(2,n+1): dp[i] = dp[i-1] + dp[i-2] print(dp[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,451
s318786677
p02233
u978799212
1576821565
Python
Python
py
Accepted
10
4636
86
n=(int)(input()) a=1 b=1 i=0 for i in range(n-1): c=a+b a=b b=c print(b)
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,452
s032330812
p02233
u529459816
1576653656
Python
Python3
py
Accepted
20
5600
282
def main(): n = int(input()) if n <= 1: print(1) else: fib_list = [1, 1] + [None] * (n - 1) for i in range(2, n + 1): fib_list[i] = fib_list[i - 1] + fib_list[i - 2] print(fib_list[n]) if __name__ == "__main__": main()
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,453
s602615327
p02233
u803276726
1576645470
Python
Python3
py
Accepted
20
5604
370
def make_fib(n): if n == 0 or n == 1: return 1 if F[n] != -1: return F[n] else: F[n] = make_fib(n-1)+make_fib(n-2) return(F[n]) def fibonacci(n): if n == 0 or n == 1: return 1 else: return(fibonacci(n-1)+fibonacci(n-2)) n = int(input()) F = [-1 for i in range(50)] F[0] = F[1] = ...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,454
s627956463
p02233
u064444227
1576458818
Python
Python3
py
Accepted
20
5604
176
n=int(input()) s=[-1 for i in range(n+1)] def fib(n): if n==0 or n==1: s[n]=1 if s[n] != -1: return s[n] s[n] = fib(n-1) + fib(n-2) return s[n] print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,455
s194804187
p02233
u794140916
1575865470
Python
Python3
py
Accepted
20
5600
268
def fibonacci(n): if n == 0 or n == 1: F[n] = 1 return F[n] elif F[n] != -1: return F[n] else: F[n] = fibonacci(n-1) + fibonacci(n-2) return F[n] F = [-1] * 50 print(fibonacci(int(input())))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,456
s657745417
p02233
u123563150
1575794311
Python
Python3
py
Accepted
20
5604
268
def fib_memo(n): memo = [-1]*(n+1) def fib(n): if n==0 or n==1: return 1 if memo[n] != -1: return memo[n] memo[n] = fib(n-1) + fib(n-2) return memo[n] return fib(n) n=int(input()) print(fib_memo(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,457
s043167058
p02233
u288628876
1575640415
Python
Python3
py
Accepted
20
5596
295
class Fib: def __init__(self): self.FIB = [1, 1] def fib(self, n): if n < len(self.FIB): return self.FIB[n] else: self.FIB.append(self.fib(n-1) + self.fib(n-2)) return self.FIB[n] N = int(input()) f = Fib() print(f.fib(N))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,458
s308729869
p02233
u958870136
1575294737
Python
Python3
py
Accepted
20
5600
191
def make_fibonacci(n): F = [] F.append(1) F.append(1) for i in range(2, n+1): F.append(F[i-2]+F[i-1]) return F n = int(input()) F = make_fibonacci(n) print(F[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,459
s426178727
p02233
u504636463
1574776225
Python
Python3
py
Accepted
20
5600
332
def fib(n: int, meolist: dict): if n == 0 or n == 1: meolist[n] = 1 return 1 elif n in meolist.keys(): return meolist[n] meolist[n] = fib(n - 1, meolist) + fib(n - 2, meolist) return meolist[n] if __name__ == '__main__': n = int(input()) meolist = {} print(fib(n...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,460
s303133151
p02233
u459733576
1574431988
Python
Python3
py
Accepted
20
5632
1,448
import time import sys input = sys.stdin.readline sys.setrecursionlimit(1000000) # 何も考えずに書いてみたやつ これ一番早いじゃん・・・ def fib_org(n): if n in (0, 1): return 1 count = 3 prevprev = 1 prev = 2 while count <= n: tmp = prevprev + prev prevprev = prev prev = tmp count +...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,461
s117287023
p02233
u821608651
1574390399
Python
Python3
py
Accepted
20
5604
242
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def main(): n=int(input()) fib=[1,1] for i in range(n-1): fib.append(fib[-1]+fib[-2]) print(fib[-1]) main()
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,462
s507313512
p02233
u578043650
1574304164
Python
Python3
py
Accepted
20
5600
131
num = int(input()) arr = [0] * 45 arr[0] = 1 arr[1] = 1 for i in range(2,45): arr[i] = arr[i-1] + arr[i-2] print(arr[num])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,463
s897123938
p02233
u957523223
1574260955
Python
Python3
py
Accepted
20
5600
113
n = int(input()) + 1 a = [0] * n a[0] = 1 a[1] = 1 for i in range(2, n): a[i] = a[i-1] + a[i-2] print(a[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,464
s809807525
p02233
u608189632
1573966032
Python
Python3
py
Accepted
20
5596
263
def fibonacci(n): global F if F[n] != -1: return F[n] elif n in [0, 1]: F[n] = 1 return F[n] else: F[n] = fibonacci(n-1) + fibonacci(n-2) return F[n] n = int(input()) F = [-1] * 45 print(fibonacci(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,465
s627577144
p02233
u793120772
1573635130
Python
Python3
py
Accepted
20
5600
157
def fib(n): ls=[0]*(n+1) ls[0]=ls[1]=1 for i in range(2,n+1): ls[i]=ls[i-1]+ls[i-2] return ls[-1] n=int(input()) print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,466
s468929192
p02233
u085485681
1573539793
Python
Python3
py
Accepted
20
5604
270
def fib(n): if n == 1 or n == 2: return 1 else: seq = [0 for _ in range(0, n)] seq[0], seq[1] = 1, 1 for i in range(2, n): seq[i] = seq[i - 1] + seq[i - 2] return seq[n - 1] n = int(input()) + 1 print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,467
s285771456
p02233
u877347085
1572966184
Python
Python3
py
Accepted
20
5600
109
N = int(input()) fib = [1,1] for i in range(2, N + 1): fib.append(fib[i - 1] + fib[i - 2]) print(fib[N])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,468
s014780606
p02233
u439083584
1572874340
Python
Python3
py
Accepted
20
5600
85
n=int(input()) dp=[1,1] for i in range(n): dp.append(dp[i]+dp[i+1]) print(dp[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,469
s186234869
p02233
u410881919
1572865567
Python
Python3
py
Accepted
20
5604
232
dp = [None for _ in range(50)] def fib(n): if n == 0 or n == 1: dp[n] = 1 return dp[n] if dp[n] != None: return dp[n] dp[n] = fib(n-1) + fib(n-2) return dp[n] n = int(input()) print(fib(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,470
s909236770
p02233
u297517978
1572534011
Python
Python3
py
Accepted
20
5600
88
l=[1,1] n=int(input()) for i in range(n): fib=[l[i]+l[i+1]] l=l+fib print(l[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,471
s499605320
p02233
u525329683
1571535859
Python
Python3
py
Accepted
20
5600
253
# https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/10/ALDS1_10_A # やるだけ n = int(input()) # dpテーブルの用意 dp = [-1]*(n+1) # dpの初期値 dp[0], dp[1] = 1, 1 for i in range(2, n+1): dp[i] = dp[i-1]+dp[i-2] print(dp[-1])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,472
s090409569
p02233
u537758214
1571455765
Python
Python3
py
Accepted
20
5612
441
def main(): N = int(input()) done = [False for i in range(N + 1)] memo = [0 for i in range(N + 1)] def do_dp(n): if done[n]: return memo[n] if n == 0: return 1 elif n == 1: return 1 else: memo[n] = do_dp(n - 1) + do_dp(n - ...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,473
s814952854
p02233
u778781355
1570929558
Python
Python3
py
Accepted
20
5596
216
A = [None] * (44 + 1) A[0] = 1 A[1] = 1 def fibonacci(n: int) -> int: if A[n] == None: A[n] = fibonacci(n - 1) + fibonacci(n - 2) return A[n] if __name__ == "__main__": n = int(input()) print(fibonacci(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,474
s375871468
p02233
u784856415
1570783738
Python
Python3
py
Accepted
20
5600
96
a=[0]*50 n=int(input()) a[0],a[1]=1,1 for i in range(2,n+1): a[i]=a[i-1]+a[i-2] print(a[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,475
s725790226
p02233
u137240270
1570061031
Python
Python3
py
Accepted
20
5596
202
def main(): n = int(input()) pre = 1 cur = 1 for _ in range(n-1): tmp = cur cur = pre + cur pre = tmp print(cur) if __name__ == '__main__': main()
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,476
s340139054
p02233
u476418873
1569927704
Python
Python3
py
Accepted
20
5596
102
Fib = [1,1] for i in range(2, 45): Fib.append(Fib[i-1]+Fib[i-2]) n = int(input()) print(Fib[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,477
s248173511
p02233
u535355886
1569686276
Python
Python3
py
Accepted
20
5596
128
n = int(input()) F = [0] * (n + 1) F[0] = 1 F[1] = 1 for i in range(2, len(F)): F[i] = F[i - 1] + F[i - 2] print(F[n])
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,478
s515257275
p02233
u806005289
1569203260
Python
Python3
py
Accepted
20
5600
187
n = int(input()) hashMap = {} def f(n): hashMap[0] = 1 hashMap[1] = 1 for i in range(2, n+1): hashMap[i] = hashMap[i-1]+hashMap[i-2] return hashMap[n] print(f(n))
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,479
s482169622
p02233
u134521115
1569129445
Python
Python3
py
Accepted
20
5604
344
import sys input = sys.stdin.readline dp: list = [-1] * 50 def fib(n: int) -> int: if n == 0 or n == 1: dp[n] = 1 return dp[n] elif dp[n] != -1: return dp[n] else: dp[n] = fib(n-1) + fib(n-2) return dp[n] def main(): n = int(input()) print(fib(n)) if __name_...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,480
s799705981
p02233
u803862921
1569074043
Python
Python3
py
Accepted
30
5604
419
num = int(input()) fibtbl = [ 0 for x in range(50)] fibtbl[0] = 1 fibtbl[1] = 1 def fib(n): global fitbl if n == 0: return 1 if n == 1: return 1 if fibtbl[n-1] != 0: p = fibtbl[n-1] else: p = fib(n-1) if fibtbl[n-2] != 0: pp = fibtbl[n-2] ...
p02233
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"> </script> <H1>Fibonacci Number</H1> <p> ...
3
3
28,481