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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s937591524 | p02233 | u854552072 | 1470177886 | Python | Python3 | py | Accepted | 30 | 7724 | 219 | def fib(n):
if n == 0:
return 1
if n == 1:
return 1
if F[n] > 0:
return F[n]
F[n] = fib(n-1) + fib(n-2)
return F[n]
n = int(input())
F = [0 for i in range(n+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
| 27,982 |
s746155971 | p02233 | u811773570 | 1473839943 | Python | Python3 | py | Accepted | 30 | 7748 | 119 | fib = [1 for i in range(45)]
for i in range(2, 45):
fib[i] = fib[i - 1] + fib[i - 2]
i = int(input())
print(fib[i]) | 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
| 27,983 |
s496128336 | p02233 | u890722286 | 1475855012 | Python | Python3 | py | Accepted | 70 | 7708 | 204 | def fib(n):
if n == 0 or n == 1:
return 1
if A[n] is not None:
return A[n]
A[n] = fib(n - 1) + fib(n - 2)
return A[n]
A = [None] * (44 + 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
| 27,984 |
s253038152 | p02233 | u027872723 | 1476637831 | Python | Python3 | py | Accepted | 40 | 7656 | 169 | # -*- coding: utf_8 -*-
n = int(input()) + 1
arr = [-1] * n
arr[0] = 1
arr[1] = 1
for i in range(2, len(arr)):
arr[i] = arr[i - 1] + arr[i - 2]
print(arr[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
| 27,985 |
s483904402 | p02233 | u813534019 | 1476753054 | Python | Python | py | Accepted | 10 | 6436 | 174 | n=input()
fn_first=1
fn_second=1
if n >= 2:
for x in xrange(n-1):
tmp = fn_first
fn_first = fn_first + fn_second
fn_second = tmp
print fn_first | 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
| 27,986 |
s157373124 | p02233 | u460172144 | 1477206392 | Python | Python3 | py | Accepted | 20 | 7736 | 591 |
def fibonacciDP(i):
if i == 0:
return 1
elif i == 1:
return 1
else:
if dp[i-1] is None and dp[i-2] is None:
dp[i-1] = fibonacciDP(i-1)
dp[i-2] = fibonacciDP(i-2)
elif dp[i-1] is None:
dp[i-1] = fibonacciDP(i-1)
elif dp[i-2] is Non... | 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
| 27,987 |
s228179050 | p02233 | u159356473 | 1479448821 | Python | Python3 | py | Accepted | 40 | 7712 | 253 | #coding:UTF-8
def FN(n):
if n==0 or n==1:
F[n]=1
return F[n]
if F[n]!=None:
return F[n]
F[n]=FN(n-1)+FN(n-2)
return F[n]
if __name__=="__main__":
n=int(input())
F=[None]*(n+1)
ans=FN(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
| 27,988 |
s997699468 | p02233 | u022407960 | 1479480665 | Python | Python3 | py | Accepted | 50 | 7700 | 488 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def fib_bad(n):
if not n or n == 1:
return 1
return fib_bad(n - 2) + fib_bad(n - 1)
def fib_dp(n):
fib_list[:1] = [1, 1]
for i in range(2, n + 1):
fib_list[i] = fib_list[i - 2] + fib_list[i - 1]
return fib_list.pop()
if ... | 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
| 27,989 |
s876768704 | p02233 | u022407960 | 1479480831 | Python | Python3 | py | Accepted | 40 | 7696 | 468 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# def fib_bad(n):
# if not n or n == 1:
# return 1
# return fib_bad(n - 2) + fib_bad(n - 1)
def fib_dp(n):
fib_list[:1] = [1, 1]
for i in range(2, n + 1):
fib_list[i] = fib_list[i - 2] + fib_list[i - 1]
return fib_list.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
| 27,990 |
s643665323 | p02233 | u022407960 | 1479481095 | Python | Python3 | py | Accepted | 50 | 7688 | 465 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
# def fib_bad(n):
# if not n or n == 1:
# return 1
# return fib_bad(n - 2) + fib_bad(n - 1)
def fib_dp(n):
fib_list[:1] = [1, 1]
for i in range(2, n + 1):
fib_list[i] = fib_list[i - 2] + fib_list[i - 1]
return 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
| 27,991 |
s271426168 | p02233 | u811733736 | 1480477566 | Python | Python3 | py | Accepted | 30 | 7712 | 660 | class Fibonacci(object):
memo = [1, 1]
def get_nth(self, n):
if n < len(Fibonacci.memo):
return Fibonacci.memo[n]
# print('fib({0}) not found'.format(n))
for i in range(len(Fibonacci.memo), n+1):
result = Fibonacci.memo[i-1] + Fibonacci.memo[i-2]
Fibo... | 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
| 27,992 |
s010998721 | p02233 | u811733736 | 1480478109 | Python | Python3 | py | Accepted | 30 | 8300 | 821 | from functools import lru_cache
@lru_cache(maxsize=None)
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2)
class Fibonacci(object):
memo = [1, 1]
def get_nth(self, n):
if n < len(Fibonacci.memo):
return Fibonacci.memo[n]
# print('fib({0}) not found'.forma... | 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
| 27,993 |
s580295932 | p02233 | u811733736 | 1480581255 | Python | Python3 | py | Accepted | 30 | 8256 | 879 | from functools import lru_cache
@lru_cache(maxsize=None)
def fib(n):
""" http://docs.python.jp/3/library/functools.html """
if n < 2:
return n
return fib(n-1) + fib(n-2)
class Fibonacci(object):
memo = [1, 1]
def get_nth(self, n):
if n < len(Fibonacci.memo):
return F... | 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
| 27,994 |
s973487695 | p02233 | u811733736 | 1480581306 | Python | Python3 | py | Accepted | 30 | 8300 | 882 | from functools import lru_cache
@lru_cache(maxsize=None)
def fib(n):
""" http://docs.python.jp/3/library/functools.html """
if n < 2:
return n
return fib(n-1) + fib(n-2)
class Fibonacci(object):
memo = [1, 1]
def get_nth(self, n):
if n < len(Fibonacci.memo):
return F... | 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
| 27,995 |
s666784923 | p02233 | u178753893 | 1481767254 | Python | Python3 | py | Accepted | 20 | 7680 | 257 | def fibonacci(n):
num1 = 1
num2 = 1
tmp = 1
for i in range(1, n):
tmp = num1 + num2
num1 = num2
num2 = tmp
return tmp
if __name__ == '__main__':
n = int(input())
result = fibonacci(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
| 27,996 |
s961184873 | p02233 | u839858749 | 1481767431 | Python | Python3 | py | Accepted | 20 | 7692 | 361 | # ???????¨?????????????????§£???
# ?????°?????¨?????¢??????????????¨???????????¢????????£???
def fibonacci(n):
num1 = 1
num2 = 1
tmp = 1
for i in range(1, n):
tmp = num1 + num2
num1 = num2
num2 = tmp
return tmp
if __name__ == '__main__':
n = int(input())
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
| 27,997 |
s654146778 | p02233 | u463990569 | 1482694011 | Python | Python3 | py | Accepted | 20 | 7720 | 157 | n = int(input())
memo = [1, 1] + [0 for _ in range(n-1)]
for i in range(n+1):
if not memo[i]:
memo[i] = memo[i - 1] + memo[i - 2]
print(memo[-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
| 27,998 |
s240107150 | p02233 | u078042885 | 1484835579 | Python | Python3 | py | Accepted | 30 | 7676 | 53 | a=b=1
for _ in range(int(input())):a,b=b,a+b
print(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
| 27,999 |
s295068509 | p02233 | u923668099 | 1485587367 | Python | Python3 | py | Accepted | 30 | 8336 | 193 | from functools import lru_cache
@lru_cache(maxsize=None)
def fib(n):
if n <= 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
n = int(input())
ans = fib(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,000 |
s642122844 | p02233 | u923668099 | 1485587532 | Python | Python3 | py | Accepted | 40 | 7740 | 144 | def fib(n):
f0, f1 = 1, 1
for i in range(n - 1):
f1, f0 = f1 + f0, f1
return f1
n = int(input())
ans = fib(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,001 |
s468118892 | p02233 | u112247126 | 1487895741 | Python | Python3 | py | Accepted | 20 | 7660 | 116 | n = int(input())
first = 1
second = 1
for i in range(n-1):
second, first = first + second, second
print(second) | 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,002 |
s964811001 | p02233 | u546285759 | 1488112078 | Python | Python3 | py | Accepted | 20 | 7664 | 87 | F = [1,1]
for i in range(2, int(input())+1):
F.append(F[i-2] + F[i-1])
print(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,003 |
s511496445 | p02233 | u831244171 | 1488541503 | Python | Python3 | py | Accepted | 20 | 7664 | 87 | a = [1]*45
for i in range(2,len(a)):
a[i] = a[i-1] + a[i-2]
print(a[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,004 |
s164527126 | p02233 | u831244171 | 1489315591 | Python | Python3 | py | Accepted | 20 | 7612 | 107 | n = int(input())
fib = [1]*(n+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,005 |
s096740057 | p02233 | u851695354 | 1489830234 | Python | Python3 | py | Accepted | 20 | 7740 | 315 | def fib(n):
if n == 0 or n == 1:
ans[n] = 1
return 1
# ?????¢???????¨?????????????????´???§????????°?????????????????????
if ans[n] != -1:
return ans[n]
ans[n] = fib(n-1) + fib(n-2)
return ans[n]
N = int(input())
ans = [-1 for i in range(N+1)]
a = fib(N)
print(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,006 |
s022161688 | p02233 | u227438830 | 1489940526 | Python | Python3 | py | Accepted | 20 | 7672 | 92 | n = int(input())
F = [1, 1]
for i in range(2,n+1):
F.append(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,007 |
s156794270 | p02233 | u756958775 | 1491140983 | Python | Python3 | py | Accepted | 30 | 7684 | 329 | def fibonacci(n, memo=None):
if memo==None:
memo = [None]*n
if n<=1:
return 1
else:
if memo[n-2]==None:
memo[n-2] = fibonacci(n-2, memo)
if memo[n-1]==None:
memo[n-1] = fibonacci(n-1, memo)
return memo[n-1] + memo[n-2]
n = int(input())
print(fibo... | 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,008 |
s624301893 | p02233 | u300946041 | 1491374547 | Python | Python3 | py | Accepted | 30 | 7592 | 220 | # -*- coding: utf-8 -*-
def main(n):
lst = [1, 1]
for i in range(2, n + 1):
lst.append(lst[i - 2] + lst[i - 1])
return lst[n]
if __name__ == '__main__':
n = int(input())
print(main(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,009 |
s481702074 | p02233 | u300946041 | 1491443984 | Python | Python3 | py | Accepted | 30 | 7560 | 216 | # -*- coding: utf-8 -*-
def main(n):
lst = [1, 1]
for i in range(2, n + 1):
lst.append(lst[i - 1] + lst[i - 2])
return lst[n]
if __name__ == '__main__':
n = int(input())
print(main(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,010 |
s900078615 | p02233 | u690870779 | 1491546107 | Python | Python | py | Accepted | 10 | 6272 | 438 | # -*- coding: utf-8 -*-
def main():
def _fibonacci(n,cache):
if n in cache:
return cache[n]
elif n == 0 or n == 1:
ret = 1
cache[n] = ret
return ret
else:
ret = _fibonacci(n - 1, cache) + _fibonacci(n - 2, cache)
cache... | 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,011 |
s942737277 | p02233 | u843404779 | 1493784033 | Python | Python3 | py | Accepted | 20 | 7692 | 309 | def fib(n, fib_table):
if n == 0 or n == 1:
return 1
if fib_table[n] != None:
return fib_table[n]
fib_table[n] = fib(n-1, fib_table) + fib(n-2, fib_table)
return fib_table[n]
n = int(input())
fib_table = [None]*(n+1)
fib_table[0] = 1
fib_table[1] = 1
print(fib(n, fib_table)) | 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,012 |
s206214021 | p02233 | u119127920 | 1494334620 | Python | Python3 | py | Accepted | 30 | 7696 | 208 |
def main():
n = int(input())
dp = [0] * 100
dp[0] = 1
dp[1] = 1
for i in range(2, len(dp)):
dp[i] = dp[i - 1] + dp[i - 2]
print(dp[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,013 |
s450201579 | p02233 | u370086573 | 1494579341 | Python | Python3 | py | Accepted | 20 | 7688 | 245 | def fibonacci(n):
if n == 0 or n == 1:
F[n] = 1
return F[n]
if F[n] is not None:
return F[n]
F[n] = fibonacci(n - 1) + fibonacci(n - 2)
return F[n]
n = int(input())
F = [None]*(n + 1)
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,014 |
s192056628 | p02233 | u089830331 | 1494698533 | Python | Python3 | py | Accepted | 20 | 7624 | 68 | a, b = 1, 1
for i in range(int(input())):
a, b = b, a + b
print(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,015 |
s862467078 | p02233 | u352522848 | 1494771794 | Python | Python | py | Accepted | 10 | 6372 | 174 | _fib = [None] * 45
_fib[0] = 1
_fib[1] = 1
def fib(n):
if _fib[n] is None:
_fib[n] = fib(n-1) + fib(n-2)
return _fib[n]
_n = int(raw_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,016 |
s557355323 | p02233 | u603049633 | 1496473269 | Python | Python3 | py | Accepted | 30 | 7720 | 229 | def makeFibonacci(n):
if n <= 1:
return str(1)
F = [None]*(n+1)
F[0] = 1
F[1] = 1
for i in range(2, n+1):
F[i] = F[i-1] + F[i - 2]
return str(F[n])
n = int(input())
print(makeFibonacci(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,017 |
s307763123 | p02233 | u297730027 | 1496717531 | Python | Python | py | Accepted | 10 | 6364 | 251 | N = 44
F = [0]*(N+1)
def dynamic(n):
if n == 0 or n == 1:
return 1
if F[n] != 0:
return F[n]
F[n] = dynamic(n - 1) + dynamic(n - 2)
return F[n]
if __name__ == '__main__':
n = int(raw_input())
print(dynamic(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,018 |
s215003247 | p02233 | u216229195 | 1496759621 | Python | Python3 | py | Accepted | 30 | 7668 | 325 | F = {}
def fib(n):
global F
if n < 0:
print("error")
exit()
if n < 2:
F[n] = 1
return F[n]
# F[n] = fib(n-1) + fib(n-2)
F[n] = F[n-1] + F[n-2]
return F[n]
n = int(input())
#print(fib(n))
#n = int(input())
#print(fib(n))
#fib(44)
for i in range(n+1):
result = fib(i)
print(result)
# print(... | 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,019 |
s187522545 | p02233 | u216229195 | 1496759719 | Python | Python3 | py | Accepted | 20 | 7656 | 223 | F = {}
def fib(n):
global F
if n < 0:
print("error")
exit()
if n < 2:
F[n] = 1
return F[n]
F[n] = F[n-1] + F[n-2]
return F[n]
n = int(input())
for i in range(n+1):
result = fib(i)
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,020 |
s956116549 | p02233 | u834139744 | 1497249749 | Python | Python3 | py | Accepted | 20 | 7648 | 191 | #!/usr/bin/python
n = int(input())
def fib(n):
l = list()
l.append(1)
l.append(1)
for i in range(2, n+1):
l.append(l[i-1] + l[i-2])
return l[-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,021 |
s276105826 | p02233 | u844704750 | 1499075616 | Python | Python3 | py | Accepted | 20 | 7732 | 262 | n = int(input())
memo = [0 for _ in range(45)]
def fib_memo(n):
if memo[n] != 0:
return memo[n]
elif (n == 0) or (n == 1):
return 1
else:
memo[n] = fib_memo(n-1) + fib_memo(n-2)
return memo[n]
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,022 |
s286884109 | p02233 | u844704750 | 1499075916 | Python | Python3 | py | Accepted | 20 | 7728 | 193 | n = int(input())
dp = [0 for _ in range(45)]
def fib_dp(n):
dp[0] = 1
dp[1] = 1
for i in range(2, n+1):
dp[i] = dp[i-1] + dp[i-2]
return dp[n]
print(fib_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,023 |
s683887894 | p02233 | u539803218 | 1499301654 | Python | Python3 | py | Accepted | 20 | 7708 | 102 | def f(n):
a, b=1, 1
for i in range(n):
a, b=a+b, a
return b
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,024 |
s934388036 | p02233 | u539803218 | 1499303018 | Python | Python3 | py | Accepted | 30 | 7736 | 108 | def g(a,b,n):
if n==0 or n==1: return a
else: return g(a+b,a,n-1)
a,b=1,1
print(g(a,b,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,025 |
s247381692 | p02233 | u539803218 | 1499303072 | Python | Python3 | py | Accepted | 20 | 7728 | 108 | def g(a,b,n):
if n==0 or n==1: return a
else: return g(a+b,a,n-1)
a,b=1,1
print(g(a,b,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,026 |
s629892550 | p02233 | u539803218 | 1499303178 | Python | Python3 | py | Accepted | 20 | 7708 | 98 | def g(a,b,n):
if n==1:return a
else:return g(a+b,a,n-1)
a,b=1,1
print(g(a,b,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,027 |
s880466830 | p02233 | u539803218 | 1499303414 | Python | Python3 | py | Accepted | 30 | 7716 | 90 | def g(a,b,n):
if n==1:return a
else:return g(a+b,a,n-1)
print(g(1,1,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,028 |
s584954724 | p02233 | u600821328 | 1499398981 | Python | Python3 | py | Accepted | 50 | 9092 | 557 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import re
import math
import itertools
import functools
import logging
logging.basicConfig(level=logging.DEBUG, format="DBG: %(message)s")
def dbg(msg, *args, **kwargs):
logging.debug(msg, *args, **kwargs)
def fib(n):
assert n >= 0
f0 = 1
f1... | 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,029 |
s807351212 | p02233 | u091533407 | 1500275553 | Python | Python3 | py | Accepted | 20 | 7632 | 133 | if __name__ == "__main__":
n = int(input())
F = [1, 1]
for i in range(n-1):
F.append(F[-2]+F[-1])
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,030 |
s061242771 | p02233 | u091533407 | 1500275750 | Python | Python3 | py | Accepted | 20 | 7660 | 335 | print([1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170]... | 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,031 |
s885902908 | p02233 | u091533407 | 1500275938 | Python | Python3 | py | Accepted | 30 | 7684 | 335 | print([1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, 701408733, 1134903170]... | 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,032 |
s266576035 | p02233 | u652080871 | 1500860387 | Python | Python3 | py | Accepted | 40 | 7648 | 178 | n = int(input().strip())
if n <= 1:
print(1)
raise SystemExit
prev1 = 1
prev2 = 1
for i in range(2, n+1):
fib = prev2 + prev1
prev2, prev1 = prev1, fib
print(fib) | 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,033 |
s229069374 | p02233 | u652080871 | 1500860395 | Python | Python3 | py | Accepted | 30 | 7644 | 178 | n = int(input().strip())
if n <= 1:
print(1)
raise SystemExit
prev1 = 1
prev2 = 1
for i in range(2, n+1):
fib = prev2 + prev1
prev2, prev1 = prev1, fib
print(fib) | 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,034 |
s868666631 | p02233 | u533883485 | 1500961933 | Python | Python3 | py | Accepted | 20 | 7676 | 366 | # coding=utf-8
def fib(n):
global fib_list
if fib_list[n]:
return fib_list[n]
if n == 0:
fib_list[0] = 1
return 1
elif n == 1:
fib_list[1] = 1
return 1
else:
fib_list[n] = fib(n-2) + fib(n-1)
return fib(n-2) + fib(n-1)
n = int(input())
fib_l... | 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,035 |
s335080481 | p02233 | u796784914 | 1502512932 | Python | Python | py | Accepted | 10 | 6440 | 326 | def main():
n = input()
F = [0]*(n+1)
number = fibonacci(n,F)
print number
def fibonacci(n,F):
if n == 0 or n == 1:
F[n] = 1
return 1
if F[n] != 0:
return F[n]
else:
F[n] = fibonacci(n-2,F)+fibonacci(n-1,F)
return F[n]
if __name__ == "__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,036 |
s376692572 | p02233 | u491916705 | 1502631162 | Python | Python | py | Accepted | 10 | 6416 | 96 | n = int(raw_input())
a = 1
b = 1
for i in range(n-1):
tmp = a
a = b
b += tmp
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,037 |
s462979774 | p02233 | u510829608 | 1502777155 | Python | Python3 | py | Accepted | 30 | 7728 | 265 | memo = {}
def fib(n):
key = n
if key in memo:
return memo[key]
if n == 0:
return 1
if n == 1:
return 1
if n > 1:
memo[key] = fib(n-1) + fib(n-2)
return memo[key]
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,038 |
s898698432 | p02233 | u855199458 | 1502868768 | Python | Python3 | py | Accepted | 20 | 7708 | 275 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(100000)
calculated = set([0, 1])
cal_fib = [0 for _ in range(45)]
cal_fib[0:2] = 1, 1
def fib(n):
if cal_fib[n] == 0:
cal_fib[n] = fib(n-1) + fib(n-2)
return cal_fib[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,039 |
s372872212 | p02233 | u193453446 | 1502959057 | Python | Python3 | py | Accepted | 30 | 7724 | 253 | def main():
""" ????????? """
num = int(input().strip())
F = []
for n in range(num+1):
if n < 2:
F.append(1)
else:
F.append(F[n-1] + F[n-2])
print (F[num])
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,040 |
s830189760 | p02233 | u519227872 | 1503403000 | Python | Python3 | py | Accepted | 20 | 7720 | 207 | n = int(input())
cache = {0: 1, 1: 1}
def fibonacci(n):
if cache.get(n, None) is not None:
return cache[n]
cache[n] = fibonacci(n-1) + fibonacci(n-2)
return cache[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,041 |
s732538661 | p02233 | u939814144 | 1503653079 | Python | Python3 | py | Accepted | 20 | 7720 | 167 | def fibonacci(n):
a, b = 1, 1
for i in range(n-1):
a, b = b, a+b
return b
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,042 |
s134233401 | p02233 | u957021183 | 1504243694 | Python | Python3 | py | Accepted | 20 | 7644 | 307 | # Aizu Problem ALDS_1_10_A: Fibonacci Number
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
n = int(input())
if n < 2:
print(1)
else:
a, b = 1, 1
for k in range(n - 1):
a, b = b, a + b
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,043 |
s960290085 | p02233 | u798803522 | 1509542341 | Python | Python3 | py | Accepted | 20 | 7768 | 228 | target = int(input()) + 1
fib = [0 for n in range(target + 1)]
for i in range(target + 1):
if i == 0:
continue
elif i == 1:
fib[i] = 1
else:
fib[i] = fib[i - 1] + fib[i - 2]
print(fib[target]) | 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,044 |
s067217897 | p02233 | u024715419 | 1510121590 | Python | Python3 | py | Accepted | 20 | 7788 | 258 | def fibonacci(f, n):
if n == 0 or n == 1:
f[n] = 1
return f[n]
if f[n]:
return f[n]
f[n] = fibonacci(f, n - 2) + fibonacci(f, n - 1)
return f[n]
n = int(input())
f = [None for i in range(n + 1)]
print(fibonacci(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,045 |
s637692391 | p02233 | u845643816 | 1511261379 | Python | Python3 | py | Accepted | 20 | 7700 | 74 | n = int(input())
x, y = 1, 1
for i in range(n):
x, y = y, x + y
print(x) | 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,046 |
s797363216 | p02233 | u626266743 | 1511269070 | Python | Python3 | py | Accepted | 40 | 7688 | 110 | n = int(input())
fib = [1, 1] + [0] * n
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,047 |
s675528465 | p02233 | u424457654 | 1511279637 | Python | Python3 | py | Accepted | 30 | 7772 | 131 | n = int(input())
fib = [1, 1] + [0 for i in range(44)]
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,048 |
s861513509 | p02233 | u539789745 | 1513401519 | Python | Python3 | py | Accepted | 20 | 5600 | 239 | def main():
n = int(input())
ans = solve1(n)
print(ans)
def solve1(n):
if n <= 1:
return 1
a, b = 1, 1
for _ in range(2, n + 1):
a, b = b, a + b
return b
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,049 |
s773437548 | p02233 | u949517845 | 1514375664 | Python | Python3 | py | Accepted | 30 | 5616 | 375 | # -*- coding:utf-8 -*-
def memoize(proc):
cache = {}
def helper(*args, **kargs):
if args not in cache:
cache[args] = proc(*args, **kargs)
return cache[args]
return helper
@memoize
def fib(n):
if n < 2:
return 1
else:
return fib(n - 1) + fib(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,050 |
s744911962 | p02233 | u736039489 | 1514475624 | Python | Python3 | py | Accepted | 20 | 5608 | 397 | # -*- coding: utf-8 -*-
def fib(n):
if n == 0 or n == 1:
return 1
return fib(n-1) + fib(n-2)
def fib_memo(n, memo):
if n == 0 or n == 1:
memo[n] = 1
return memo[n]
if memo[n] != -1:
return memo[n]
memo[n] = fib_memo(n-1, memo) + fib_memo(n-2, memo)
return memo[... | 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,051 |
s246684520 | p02233 | u433154529 | 1514524459 | Python | Python3 | py | Accepted | 30 | 6296 | 246 | from functools import lru_cache
counter = 0
@lru_cache(maxsize=1024)
def fib(n):
global counter
counter += 1
if n in [0, 1]:
return 1
return fib(n - 1) + fib(n - 2)
if __name__ == '__main__':
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,052 |
s150226310 | p02233 | u433154529 | 1514524596 | Python | Python3 | py | Accepted | 30 | 6292 | 199 | from functools import lru_cache
@lru_cache(maxsize=1024)
def fib(n):
if n in [0, 1]:
return 1
return fib(n - 1) + fib(n - 2)
if __name__ == '__main__':
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,053 |
s199268778 | p02233 | u146816547 | 1515769662 | Python | Python | py | Accepted | 10 | 4632 | 96 | n = int(raw_input())
dp = [1, 1]
for i in range(50):
dp += [dp[-1] + dp[-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,054 |
s853683910 | p02233 | u662418022 | 1517821766 | Python | Python3 | py | Accepted | 20 | 5604 | 349 | # -*- coding: utf-8 -*-
if __name__ == '__main__':
n = int(input())
F = [None]*(n+1)
def fibonacci(n):
if n == 0 or n == 1:
F[n] = 1
return F[n]
if F[n] is not None:
return F[n]
F[n] = fibonacci(n-2) + fibonacci(n-1)
return 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,055 |
s391124287 | p02233 | u869924057 | 1518087765 | Python | Python3 | py | Accepted | 20 | 5600 | 163 | memo = [1, 1]
def fib(n):
if (n < len(memo)):
return memo[n]
memo.append(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,056 |
s334936352 | p02233 | u779137493 | 1518088041 | Python | Python3 | py | Accepted | 20 | 5600 | 163 | num = int(input())
dp = { 0: 1, 1: 1 }
def fibonacci(n):
if not n in dp:
dp[n] = fibonacci(n - 1) + fibonacci(n - 2)
return dp[n]
print(fibonacci(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,057 |
s442536781 | p02233 | u117140447 | 1518089394 | Python | Python3 | py | Accepted | 20 | 5604 | 272 | import sys
numbers = []
for line in sys.stdin:
numbers.append(int(line))
k = []
k.append(1)
k.append(1)
def getFib(i, n):
if i == n :
print(k[-1])
return
k.append(int(k[i - 1]) + int(k[i - 2]))
getFib(i + 1, n)
getFib(2, int(numbers[0])+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,058 |
s843371834 | p02233 | u426534722 | 1518532967 | Python | Python3 | py | Accepted | 20 | 5600 | 104 | n = int(input())
fi = [1] * 50
for i in range(2, n + 1):
fi[i] = fi[i - 1] + fi[i - 2]
print(fi[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,059 |
s028687915 | p02233 | u150984829 | 1519717043 | Python | Python3 | py | Accepted | 20 | 5600 | 69 | f=[1,1]
for _ in range(2,45):f+=[sum(f[-2:])]
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,060 |
s036020459 | p02233 | u150984829 | 1519717298 | Python | Python3 | py | Accepted | 20 | 5600 | 63 | f=[1,1]
for _ in[0]*43:f+=[f[-2]+f[-1]]
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,061 |
s059872003 | p02233 | u150984829 | 1519717513 | Python | Python3 | py | Accepted | 20 | 5592 | 54 | a=b=1
for _ in range(int(input())):a,b=b,a+b
print(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,062 |
s351507297 | p02233 | u150984829 | 1519718334 | Python | Python3 | py | Accepted | 20 | 5640 | 65 | p,n=(1+5**.5)/2,int(input())+1
print(int((p**n-(1-p)**n)/5**.5))
| 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,063 |
s725803630 | p02233 | u912143677 | 1522140364 | Python | Python3 | py | Accepted | 20 | 5604 | 246 | n = int(input())
memo = [-1 for i in range(n+1)]
def fib(n):
if n == 0 or n == 1:
memo[n] = 1
return memo[n]
if memo[n] >= 0:
return memo[n]
memo[n] = fib(n - 2) + fib(n - 1)
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,064 |
s593370967 | p02233 | u091332835 | 1522739897 | Python | Python3 | py | Accepted | 20 | 5600 | 126 | n = int(input())
A = []
A.append(1)
A.append(1)
if n>1:
for i in range(n-1):
A.append(A[i]+A[i+1])
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,065 |
s767336815 | p02233 | u135421061 | 1523242409 | Python | Python3 | py | Accepted | 30 | 5604 | 270 |
f = [-1 for i in range(45)]
f[0] = f[1] = 1
def fib(n):
global f
for i in range(2,n+1):
f[i] = f[i - 1] + f[i - 2]
#print(i,f[i])
return f[n]
if __name__ == "__main__":
n = input()
n = int(n)
#print(type(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,066 |
s526590321 | p02233 | u126478680 | 1525379682 | Python | Python3 | py | Accepted | 20 | 5600 | 173 | fib_dic = {0:1, 1:1}
def fib(n):
ans = fib_dic.get(n)
if ans == None:
fib_dic[n] = fib(n-1) + fib(n-2)
return fib_dic[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,067 |
s945086174 | p02233 | u255317651 | 1525433067 | Python | Python3 | py | Accepted | 20 | 5616 | 322 | # -*- coding: utf-8 -*-
"""
Created on Fri May 4 20:13:10 2018
ALDS1_10_A
@author: maezawa
"""
fib_arr = [None for _ in range(45)]
fib_arr[0] = 1
fib_arr[1] = 1
def fib(n):
if fib_arr[n] != None:
return fib_arr[n]
fib_arr[n] = fib(n-1)+fib(n-2)
return fib_arr[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,068 |
s471142287 | p02233 | u138546245 | 1525485567 | Python | Python3 | py | Accepted | 20 | 5612 | 400 | MAXN = 45
fibs = [-1] * MAXN
def fib(n):
"""Returns n-th fibonacci number
>>> fib(3)
3
>>> fib(10)
89
>>> fib(20)
10946
"""
if n == 0:
return 1
elif n == 1:
return 1
elif fibs[n] == -1:
fibs[n] = fib(n-1) + fib(n-2)
return fibs[n]
def run():... | 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,069 |
s287437774 | p02233 | u724548524 | 1526408461 | Python | Python3 | py | Accepted | 20 | 5600 | 104 | f = [1, 1] + [0] * (int(input()) - 1)
for i in range(2, len(f)):f[i] = f[i - 2] + f[i - 1]
print(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,070 |
s687397501 | p02233 | u843169619 | 1526538490 | Python | Python3 | py | Accepted | 20 | 5600 | 114 | n = int(input())
f = [1,1]
for i in range(2,n+1):
nf = f[i-2] + f[i-1]
f.append(nf)
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,071 |
s731865319 | p02233 | u088372268 | 1526706065 | Python | Python3 | py | Accepted | 20 | 5604 | 276 | N = int(input())
F = [0 for i in range(N+1)]
def fib(n):
if n == 0 or n == 1:
F[n] = 1
return F[n]
if F[n]:
return F[n]
F[n] = fib(n-2) + fib(n-1)
return F[n]
def main():
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,072 |
s331046084 | p02233 | u404682284 | 1528556538 | Python | Python3 | py | Accepted | 20 | 5604 | 262 | def fibonacci(i, num_list):
if i == 0 or i == 1:
num_list[i] = 1
else:
num_list[i] = num_list[i-2] + num_list[i-1]
n = int(input()) + 1
num_list = [0 for i in range(n)]
for i in range(n):
fibonacci(i, num_list)
print(num_list[-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,073 |
s012945196 | p02233 | u684241248 | 1528614549 | Python | Python3 | py | Accepted | 20 | 5604 | 211 | # -*- coding: utf-8 -*-
fibs = {0: 1, 1: 1}
def fib(n):
if n not in fibs:
fibs[n] = fib(n - 1) + fib(n - 2)
return fibs[n]
if __name__ == '__main__':
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,074 |
s081660577 | p02233 | u684241248 | 1528627853 | Python | Python3 | py | Accepted | 40 | 6296 | 240 | # -*- coding: utf-8 -*-
import functools
@functools.lru_cache(maxsize=None)
def fib(n):
if n <= 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
if __name__ == '__main__':
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,075 |
s317092680 | p02233 | u011621222 | 1528970090 | Python | Python3 | py | Accepted | 20 | 5596 | 118 | a=1
b=1
c=[]
n=int(input())
c.append(a)
c.append(b)
for i in range(n):
c.append(a+b)
d=b
b+=a
a=d
print(c[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,076 |
s661018103 | p02233 | u559106458 | 1529411731 | Python | Python3 | py | Accepted | 20 | 5600 | 119 | a=1
b=1
c=[]
n=int(input())
c.append(a)
c.append(b)
for i in range(n):
c.append(a+b)
d=b
b+=a
a=d
print(c[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,077 |
s241245896 | p02233 | u318430977 | 1529510243 | Python | Python3 | py | Accepted | 20 | 5600 | 126 | n = int(input())
fib = []
fib.append(1)
fib.append(1)
for _ in range(n - 1):
fib.append(fib[-2] + fib[-1])
print(fib[-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,078 |
s402558135 | p02233 | u548155360 | 1529925668 | Python | Python3 | py | Accepted | 20 | 5604 | 273 | # coding=utf-8
def fib(number):
if number == 0 or number == 1:
return 1
memo1 = 1
memo2 = 1
for i in range(number-1):
memo1, memo2 = memo1+memo2, memo1
return memo1
if __name__ == '__main__':
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,079 |
s860644117 | p02233 | u007270338 | 1529974190 | Python | Python3 | py | Accepted | 30 | 5608 | 236 | #coding:utf-8
n = int(input())
F = [False for i in range(n+1)]
def fib(n):
if n == 0 or n == 1:
F[n] = 1
return 1
if F[n]:
return F[n]
F[n] = fib(n-2) + fib(n-1)
return F[n]
a = fib(n)
print(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,080 |
s567752286 | p02233 | u912237403 | 1375187670 | Python | Python | py | Accepted | 10 | 4200 | 78 | import sys
n=input()
a,b = 0,1
for i in range(0,n):
a,b = b,a+b;
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,081 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.