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
s052848630
p02233
u216229195
1568983703
Python
Python3
py
Accepted
20
5604
218
def fibr(n): if arr[n] != 0: return arr[n] if n < 2: arr[n] = 1 else: arr[n] = fibr(n-1) + fibr(n-2) return arr[n] n = int(input()) arr = [0 for i in range(n+1)] print(fibr(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,482
s716568998
p02233
u153665391
1568850584
Python
Python3
py
Accepted
20
5600
101
N = int(input()) a, b = 1, 1 n = 0 while n <= N: if n > 1: a, b = b, a + b n += 1 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,483
s177710719
p02233
u208260150
1568782667
Python
Python3
py
Accepted
20
5604
106
n=int(input()) n+=1 dp=[1 for i in range(n)] for i in range(2,n): 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,484
s197024331
p02233
u511037423
1568443670
Python
Python3
py
Accepted
20
5600
223
n = int(input()) def fibonacci(n): if n <= 1: dp[n] = 1 return 1 if dp[n] != -1: return dp[n] else: dp[n] = fibonacci(n-1)+fibonacci(n-2) return dp[n] dp = [-1]*(n+1) fibonacci(n) 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,485
s052864162
p02233
u183700122
1568374697
Python
Python3
py
Accepted
20
5596
85
n = int(input()) n1 = 1 n2 = 1 for i in range(n): n1, n2 = n2, n1+n2 print(n1)
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,486
s651783232
p02233
u526189710
1568196375
Python
Python3
py
Accepted
20
5600
127
n = int(input()) fib=[] fib.append(1) fib.append(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,487
s765302743
p02233
u824708460
1568041187
Python
Python3
py
Accepted
20
5600
124
fib = [0] * 45 fib[0] = fib[1] = 1 for i in range(2, 45): fib[i] = fib[i - 1] + fib[i - 2] 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,488
s847865443
p02233
u631142478
1566473286
Python
Python3
py
Accepted
20
5600
247
def fib(n): if n == 0 or n == 1: return 1 else: a = [1, 1] for i in range(2, n + 1): a.append(a[i - 1] + a[i - 2]) return a[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,489
s375926487
p02233
u698762975
1565021373
Python
Python3
py
Accepted
20
5600
80
n=int(input()) l=[1,1] for i in range(n-1): l.append(l[-1]+l[-2]) 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,490
s268123915
p02233
u108130680
1564911844
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,491
s399941269
p02233
u965938983
1564897716
Python
Python3
py
Accepted
20
5596
194
n = int(input()) dp = [-1] * 100 dp[0] = 1 dp[1] = 1 def fib(n): for i in range(2, n+1): dp[i] = dp[i-1] + dp[i-2] return dp[n] if __name__ == "__main__": 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,492
s260676761
p02233
u639928232
1564896187
Python
Python3
py
Accepted
20
5600
149
n=int(input()) a=[] a.append(1) a.append(1) mamo =[-1]*100 for i in range(2,n+1): a.append(a[i-1]+a[i-2]) i+=1 # if mamo[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,493
s094993584
p02233
u817810878
1564722187
Python
Python3
py
Accepted
20
5604
351
def fibonacchi(n: int) -> int: global computed_result if computed_result.get(n): return computed_result[n] else: computed_result[n] = fibonacchi(n - 2) + fibonacchi(n - 1) return computed_result[n] if __name__ == "__main__": n = int(input()) computed_result = {0 : 1, 1: 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,494
s391642901
p02233
u453734454
1564718325
Python
Python3
py
Accepted
20
5604
185
import sys m = int(input()) f = [0]*50 def fib(n): if n==0 or n==1: f[n] == 1 return 1 if f[n]!=0: return f[n] f[n] = fib(n-2) + fib(n-1) return f[n] print(fib(m))
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,495
s540216253
p02233
u089486079
1564717097
Python
Python3
py
Accepted
20
5600
237
dp=[0]*50 dp[0]=1 dp[1]=1 N = int(input()) def makefib(n): if n == 0 or n == 1: return 1 elif dp[n] == 0: dp[n] = makefib(n-1) + makefib(n-2) return dp[n] else: return dp[n] print(makefib(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,496
s621606746
p02233
u529337794
1564576687
Python
Python3
py
Accepted
20
5592
74
N = int(input()) a = b = 1 while N: a, b = b, a+b N -= 1 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,497
s322554545
p02233
u482227082
1564490295
Python
Python3
py
Accepted
20
5608
305
def fib(n, memo={}): if n == 0: return 1 elif n == 1: return 1 elif n in memo: return memo[n] else: memo[n] = fib(n-1, memo)+fib(n-2, memo) return memo[n] def main(): 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,498
s053020881
p02233
u182175955
1563504486
Python
Python3
py
Accepted
20
5596
186
import sys n=int(input()) if n<=1: print(1) sys.exit() else: i=1 a0=1 a1=1 while i<=n-1: temp=a1 a1+=a0 a0=temp i+=1 print(a1)
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,499
s136433671
p02233
u315511072
1561844808
Python
Python3
py
Accepted
20
5600
91
dp = [1,1] n = int(input()) for i in range(1,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,500
s689575079
p02233
u894062759
1561679779
Python
Python3
py
Accepted
20
5600
405
n = int(input()) dp = [0]*(n+1) def calc(n): global dp for i in range(n+1): if i == 0: dp[i] = 1 elif i == 1: dp[i] = 1 else: dp[i] = dp[i-1] + dp[i-2] def fibonacci(n): if n == 0: return 1 if n == 1: return 1 else: ...
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,501
s539777380
p02233
u350698365
1561435161
Python
Python3
py
Accepted
20
5600
299
n = int(input()) dp = [None] * (n+1) dp[0] = 1 dp[1] = 1 def main(): print(fib(n)) def fib(n): if n == 0 or n == 1: return 1 elif dp[n] != None: return dp[n] else: dp[n] = fib(n-1) + fib(n-2) return 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,502
s365560935
p02233
u638043175
1561293744
Python
Python3
py
Accepted
20
5608
290
import sys input = sys.stdin.readline def fibo(i, dp): if dp[i] != -1: return dp[i] dp[i] = fibo(i-1, dp) + fibo(i-2, dp) return dp[i] def main(): n = int(input().strip()) dp = [-1 for i in range(n+1)] dp[0] = 1 dp[1] = 1 print(fibo(n, dp)) 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,503
s822381204
p02233
u902579831
1560962879
Python
Python3
py
Accepted
20
5600
277
N_MAX = 45 # 0 ≤ n ≤ 44 F = [None] * N_MAX def fibonacci(n): if n == 0 or n == 1: F[n] = 1 return F[n] if F[n] != None: return F[n] F[n] = fibonacci(n - 1) + fibonacci(n - 2) return F[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,504
s719457182
p02233
u135880652
1560679831
Python
Python3
py
Accepted
20
5600
204
n = int(input()) fib = [0] * 45 for i in range(len(fib)): if i == 0 or i == 1: fib[i] = 1 else: fib[i] = fib[i-1] + fib[i-2] if i == n: print(fib[i]) break
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,505
s334041651
p02233
u317583692
1560677326
Python
Python3
py
Accepted
20
5600
177
l = [0 for i in range(45)] l[0] = 1 l[1] = 1 def F(n): if l[n] != 0: return l[n] else: l[n] = F(n-1) + F(n-2) return l[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,506
s227083577
p02233
u653744760
1560251145
Python
Python3
py
Accepted
20
5600
174
n=int(input()) if n==0 or n==1: print(1) else: fib=[0]*(n+1) fib[0]=1 fib[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,507
s608604447
p02233
u821080069
1558851167
Python
Python3
py
Accepted
20
5604
176
fib_table = [0 for _ in range(45)] fib_table[0], fib_table[1] = 1, 1 for i in range(2, 45): fib_table[i] = fib_table[i-1]+fib_table[i-2] n = int(input()) print(fib_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,508
s255137234
p02233
u874332113
1558772585
Python
Python3
py
Accepted
20
5604
451
import sys sys.setrecursionlimit(10**7) # n = int(input()) # a, b = map(int, input().split()) # int_list = list(map(int, input().split())) # l = list(input().split()) mem = {} def fib(n): if n == 0: return 1 if n == 1: return 1 if n not in mem.keys(): res = 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,509
s747218932
p02233
u970810709
1558667947
Python
Python3
py
Accepted
20
5592
187
n = int(input()) fn0 = 1 fn1 = 1 if n == 0: fn = fn0 elif n == 1: fn = fn1 else: for ni in range(2, n+1): fn = fn0 + fn1 fn0 = fn1 fn1 = fn print(fn)
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,510
s015791336
p02233
u454636644
1558372045
Python
Python3
py
Accepted
20
5600
166
n = int(input()) if n < 3: print(n) else: n_1 = 1 n_2 = 1 for i in range(2, n+1): n_0 = n_1 + n_2 n_2, n_1 = n_1, n_0 print(n_0)
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,511
s007272957
p02233
u197615397
1558234351
Python
Python3
py
Accepted
20
5600
94
n = int(input()) a = [1, 1] for i in range(2, n+1): a.append(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,512
s211913714
p02233
u910909659
1558002239
Python
Python3
py
Accepted
30
5600
141
n = int(input()) if n ==0 or n==1: print(1) else: a = [1,1] for i in range (n-1): a.append(a[i]+a[i+1]) 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,513
s668564149
p02233
u637657888
1558001467
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,514
s605849865
p02233
u088264506
1557293177
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): 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,515
s167167448
p02233
u805716376
1556962373
Python
Python3
py
Accepted
20
5592
64
c=int(input()) a,b =1,1 while c-1: a,b=a+b,a;c -=1 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,516
s797982175
p02233
u967553879
1554810294
Python
Python3
py
Accepted
20
5600
218
dp = {} def fib(n): if n in dp: return dp[n] else: if n <= 1: dp[n] = 1 else: 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,517
s949810015
p02233
u062898953
1554104154
Python
Python3
py
Accepted
30
5600
111
n = int(input()) f = [0]*(n+3) f[0], f[1] = 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,518
s647092740
p02233
u597769560
1553174152
Python
Python3
py
Accepted
20
5616
365
# -*- coding: utf-8 -*- """ Created on Thu Mar 21 21:43:51 2019 @author: Yamazaki Kenichi """ s = int(input()) #T = [-1 for i in range(s+1)] #T[0],T[1] = 1,1 #def fib(n): # if T[n] != -1: # return T[n] # else: # T[n] = fib(n-2) + fib(n-1) # return T[n] #print(fib(s)) F = [1,1] for i in ran...
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,519
s325864179
p02233
u452220492
1552718094
Python
Python3
py
Accepted
20
5600
314
memo = {} def f(n): if n == 0: return 1 if n == 1: return 1 a1 = memo.get(n - 1) if not a1: a1 = f(n - 1) memo[n - 1] = a1 a2 = memo.get(n - 2) if not a2: a2 = f(n - 2) memo[n - 2] = a2 return a1 + a2 n = int(input()) 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,520
s813768554
p02233
u621676340
1552665788
Python
Python3
py
Accepted
20
5596
100
n=int(input()) dp=[0]*45 dp[:2]=[1,1] for i in range(2,n+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,521
s098594760
p02233
u276288047
1551924421
Python
Python3
py
Accepted
20
5596
146
# coding: utf-8 def fib(a, b, c): if c==0: return a return fib(a+b, a, c-1) n = int(input().rstrip()) print(fib(0, 1, 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,522
s363406995
p02233
u415714413
1550464976
Python
Python3
py
Accepted
20
5600
215
def fib(F, n): if n == 0: return 1 if n == 1: return 1 else: F.append(fib(F, n-1) + F[n-2]) return F[n] n = int(input()) F = [1, 1] ans = fib(F, n) print(str(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,523
s011148991
p02233
u937018172
1549790473
Python
Python3
py
Accepted
20
5600
194
N = int(input()) def fibo(n, cache): cache[0] = 1 cache[1] = 1 for n in range(2, N+1): cache[n] = cache[n-1] + cache[n-2] return cache print(fibo(N, [-1]*(N+1))[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,524
s772683895
p02233
u874395007
1548574939
Python
Python3
py
Accepted
20
5600
201
n = int(input()) MAX = 45 table = [0] * MAX for i in range(MAX): # print(n) if i == 0 or i == 1: table[i] = 1 else: table[i] = table[i - 1] + table[i - 2] print(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,525
s350881582
p02233
u798796508
1547688098
Python
Python3
py
Accepted
20
5592
299
n = int(input()) f1 = 1 f2 = 1 ans = 0 if n == 0 or n == 1: ans = 1 else: for i in range(n-1): if i%2 == 0: f1 = (f1 + f2) ans = f1 #print(f1, f2) else: f2 = (f1 + f2) ans = f2 #print(f1, f2) 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,526
s965018675
p02233
u803657704
1547528073
Python
Python3
py
Accepted
20
5600
216
dp = [0]*50 def fib(n): if dp[n] != 0: return dp[n] if n==0: dp[n] = 1 elif n==1: dp[n] = 1 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,527
s754944224
p02233
u477100751
1543325346
Python
Python3
py
Accepted
20
5600
143
n = int(input()) for i in range(n+1): if i == 0 or i == 1: a = b = c = 1 else: c = a + b a, b = b, c print(c)
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,528
s488201899
p02233
u689181927
1543239343
Python
Python3
py
Accepted
20
5596
343
def fibonacci(F, n): if n == 0 or n == 1: F[n] = 1 return F[n] if F[n]: return F[n] else: F[n] = fibonacci(F, n-1) + fibonacci(F, n-2) return F[n] if __name__ == "__main__": n = int(input()) F = [] for _ in range(n+1): F.append(None) fibonacci...
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,529
s755959698
p02233
u467648242
1543025739
Python
Python3
py
Accepted
20
5600
226
n = int(input()) a0 = 1 a1 = 1 aList = [a0, a1] if n == 0: print(a0) exit() elif n == 1: print(a1) exit() else: for i in range(2, n+1): aList.append(aList[i-1] + aList[i-2]) print(aList[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,530
s641687080
p02233
u339728776
1542947670
Python
Python3
py
Accepted
20
5600
123
fib = [0]*45 fib[0] = 1 fib[1] = 1 for i in range(2, 45): fib[i] = fib[i-1] + fib[i-2] x = int(input()) print(fib[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,531
s918388608
p02233
u717526540
1542700530
Python
Python3
py
Accepted
20
5596
110
n = int(input()) fib = [1, 1] for i in range(2, n+1): fib.append(fib[i-1] + fib[i-2]) print(fib.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,532
s180321940
p02233
u978863922
1542115573
Python
Python3
py
Accepted
20
5600
555
#Fibonacci Number #http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A&lang=jp class fibonacci: def __init__(self): self.result: List[int] = [-1]*1000 return def calc(self,n): if (n == 0 or n == 1): self.result[n] = 1 return 1 if (self.r...
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,533
s405137228
p02233
u125481461
1541544218
Python
Python3
py
Accepted
20
5596
275
def fibonacci(n): if n <= 1: return 1 fib_array = [1] * 45 for i in range(2, n+1): fib_array[i] = fib_array[i-1] + fib_array[i-2] return fib_array[n] def main(): n = int(input()) fib = fibonacci(n) print(fib) return 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,534
s446431558
p02233
u726330006
1540127557
Python
Python3
py
Accepted
20
5588
78
n=int(input()) a=1 b=1 for i in range(n-1): c=b b+=a a=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,535
s389979970
p02233
u260980560
1539413324
Python
Python3
py
Accepted
20
5592
75
N = int(input()) a = b = 1 while N: a, b = b, a+b N -= 1 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,536
s289311138
p02233
u498066648
1539344936
Python
Python3
py
Accepted
30
6300
168
n = int(input()) from functools import lru_cache @lru_cache(maxsize=1000) def fibo(n): if n < 2: return 1 return fibo(n-1) + fibo(n-2) 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,537
s733235783
p02233
u094978706
1539262010
Python
Python3
py
Accepted
20
5600
163
def fib(n): l = [0]*(n+1) l[0] = 1 l[1] = 1 for i in range(2, n+1): l[i] = l[i-1] + l[i-2] return l[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,538
s839703795
p02233
u760378812
1539188679
Python
Python3
py
Accepted
20
5596
207
p = int(input()) def fib(n): dp = [0] * 50 for i in range(n+1): if i == 0 or i == 1: dp[i] = 1 else: dp[i] = dp[i-1] + dp[i-2] return dp[n] print(fib(p))
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,539
s178182142
p02233
u629780968
1538116738
Python
Python3
py
Accepted
20
5600
311
memo = {} #メモ化されないと時間がかかる def fib(n): if n == 0 or n == 1: return 1 # else: # return fib(n-1) + fib(n-2) else: if n-1 not in memo: memo[n-1] =fib(n-1) if n-2 not in memo: memo[n-2] = fib(n-2) return memo[n-1]+memo[n-2] 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,540
s703325257
p02233
u487861672
1537792706
Python
Python3
py
Accepted
30
5612
337
def fib(n): fib.cache = vars(fib).setdefault("cache", {}) def f(n): if n <= 1: return 1 else: return fib(n - 1) + fib(n - 2) if n not in fib.cache: fib.cache[n] = f(n) return fib.cache[n] def main(): print(fib(int(input()))) if __name__ == '__mai...
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,541
s492009684
p02233
u428631405
1537694214
Python
Python3
py
Accepted
20
5600
312
# フィボナッチ数列 n = int(input()) F = [0] * (n + 1) def fibonacci(n): global F if n == 0 or n == 1: F.append(1) F.append(1) return 1 if F[n] != 0: return F[n] F[n] = fibonacci(n - 1) + fibonacci(n - 2) return F[n] ans = fibonacci(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,542
s564985485
p02233
u637322311
1537598539
Python
Python3
py
Accepted
20
5600
254
A = {} def fibonacci(n): global A if n == 0 or n == 1: A[n] = 1 return A[n] if n in A: return A[n] else: A[n] = fibonacci(n - 2) + fibonacci(n - 1) return A[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,543
s737065637
p02233
u462873421
1537514993
Python
Python
py
Accepted
0
4632
119
n=int(raw_input().strip()) a=1 b=1 if n<=1: print 1 else: for i in xrange(1,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,544
s213135160
p02233
u697145890
1537449150
Python
Python3
py
Accepted
30
6372
279
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 for i in range(2,45): table[i] = table[i-1]+table[i-2] N = int(input()) 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,545
s328062109
p02233
u584076530
1534679113
Python
Python3
py
Accepted
20
5604
142
n = int(input()) dp = [0 for _ in range(45)] 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,546
s222629856
p02233
u279605379
1534419083
Python
Python3
py
Accepted
20
5600
247
def fib_loop(a, t, n): if a < n: return fib_loop(a+1, (t[0]+t[1],t[0]), n) else: return t[0] + t[1] def fib(n): if n < 2: return 1 else: return fib_loop(2, (1,1), 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,547
s293566155
p02233
u183630046
1534309242
Python
Python3
py
Accepted
20
5600
147
n = int(input()) if n < 2: print(1) else: F = [1, 1] for i in range(2, n + 1): F.append(F[i - 2] + F[i - 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,548
s654832518
p02233
u657361950
1533444974
Python
Python3
py
Accepted
20
5600
150
n = int(input()) if n < 2: ans = 1 else: a = [0] * (n+1) a[0] = a[1] = 1 for i in range(2, n+1): a[i] = a[i-1] + a[i-2] ans = a[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,549
s457650921
p02233
u891568341
1533298277
Python
Python3
py
Accepted
20
5596
251
def calculate(nums): nums = nums.append(nums[-2] + nums[-1]) return nums n = int(input()) number_list = [0,1] while True: if len(number_list) == n+2: print(number_list[-1]) break else: calculate(number_list)
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,550
s815477920
p02233
u578148790
1533296068
Python
Python3
py
Accepted
20
5600
106
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,551
s842722020
p02233
u938878704
1533023272
Python
Python3
py
Accepted
20
5600
287
memo = {} def fib(n) : if n in memo.keys() : return memo[n] else : if n == 0 : return 1 elif n == 1 : return 1 else : memo[n] = fib(n - 1) + fib(n - 2) return memo[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,552
s967374602
p02233
u940395729
1532404656
Python
Python3
py
Accepted
20
5600
503
class Fibonacci(object): record = [1, 1] def get_nth(self, n): if n < len(Fibonacci.record): return Fibonacci.record[n] for i in range(len(Fibonacci.record), n+1): result = Fibonacci.record[i-1] + Fibonacci.record[i-2] Fibonacci.record.append(res...
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,553
s605114658
p02233
u207394722
1532394788
Python
Python3
py
Accepted
20
5596
409
class fibNum(): def __init__(self): self.arr = [1, 1] def fib(self, n): return_num = 1 if n > 1: if len(self.arr) <= n: self.arr.append( self.fib(n-1) + self.fib(n-2) ) return_num = self.arr[n] return return_num def main(): n = int( 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,554
s039438942
p02233
u269568674
1532340599
Python
Python3
py
Accepted
20
5600
148
def fibonacci(n): a = [1]*2 for i in range(2,n+1): a[0],a[1] = a[1],a[0]+a[1] return a[1] 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,555
s708044471
p02233
u281836941
1529317248
Python
Python3
py
Accepted
20
5604
263
# coding: utf-8 memo={} def fib(n): if n==0 or n==1: return 1 else: if n-1 not in memo: memo[n-1]=fib(n-1) if n-2 not in memo: memo[n-2]=fib(n-2) return memo[n-1]+memo[n-2] 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,556
s156925776
p02233
u079141094
1467965035
Python
Python3
py
Accepted
30
7644
196
# Dynamic Programming - Fibonacci Number memo = [0]*45 for i in range(45): if i == 0 or i == 1: memo[i] = 1 else: memo[i] = memo[i-1] + memo[i-2] print(memo[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,557
s371308985
p02233
u805411170
1423337270
Python
Python3
py
Accepted
30
6724
146
a=[1,1] def fib(n): try: return a[n] except: a.append(fib(n-2)+fib(n-1)) return a[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,558
s478613923
p02234
u233232390
1453256231
Python
Python
py
Accepted
80
6528
469
def solve(a): n = len(a) cost = [[0 for i in range(n)] for j in range(n)] for length in range(2, n+1): for i in range(0, n-length+1): k = i+length-1 def f(i,j,k): return cost[i][j-1]+cost[j][k]+M[i][0]*M[j-1][1]*M[k][1] cost[i][k] = min([f(i,j,k)...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,559
s232252855
p02234
u233232390
1453256261
Python
Python
py
Accepted
80
6476
467
def solve(a): n = len(a) cost = [[0 for i in range(n)] for j in range(n)] for length in range(2, n+1): for i in range(0, n-length+1): k = i+length-1 def f(i,j,k): return cost[i][j-1]+cost[j][k]+M[i][0]*M[j-1][1]*M[k][1] cost[i][k] = min([f(i,j,k)...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,560
s647229596
p02234
u233232390
1453258261
Python
Python
py
Accepted
80
6576
405
def solve(a): n = len(a) cost = [[0 for i in range(n)] for j in range(n)] for length in range(2, n+1): for i in range(0, n-length+1): k = i+length-1 def f(i,j,k): return cost[i][j-1]+cost[j][k]+M[i][0]*M[j-1][1]*M[k][1] cost[i][k] = min([f(i,j,k) for j in range(i+1,k+1)]) return cost[0][n-1] n = inpu...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,561
s231061821
p02234
u233232390
1453258278
Python
Python
py
Accepted
80
6488
405
def solve(a): n = len(a) cost = [[0 for i in range(n)] for j in range(n)] for length in range(2, n+1): for i in range(0, n-length+1): k = i+length-1 def f(i,j,k): return cost[i][j-1]+cost[j][k]+M[i][0]*M[j-1][1]*M[k][1] cost[i][k] = min([f(i,j,k) for j in range(i+1,k+1)]) return cost[0][n-1] n = inpu...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,562
s297918091
p02234
u047737909
1453349368
Python
Python
py
Accepted
80
6532
443
def edit_distance(M): n = len(M) m = [[0 for i in range(n)] for j in range(n)] for long in range(2, n+1): for i in range(0, n-long+1): j = i + long - 1 def a(i, k ,j): return m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] m[i][j] = min(a(i, k, j) for k in range(i, j)) ...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,563
s139470847
p02234
u655651061
1453574270
Python
Python
py
Accepted
80
6564
347
def cost(i,k,j): return m[i][k] + m[k+1][j] + p[i][0] * p[k][1] * p[j][1] n = input() p = [] m = [[0 for i in xrange(n)] for j in xrange(n)] for i in xrange(n): p.append(map(int, raw_input().split())) N = len(p) for l in xrange(2,N+1): for i in xrange(0,N-l+1): j = i+l-1 m[i][j] = min(cost(i,k,j) for k in xr...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,564
s263558247
p02234
u038005340
1453694767
Python
Python
py
Accepted
90
6504
388
def cost( i,k,j ): return m[i][k] + m[k+1][j] + M[i][0] * M[k][1] * M[j][1] n = input() M = [] m = [[ 0 for i in range(n) ] for j in range(n) ] for i in range(n): M.append( map (int, raw_input().split() ) ) M_long = len(M) for l in range( 2,M_long+1 ): for i in range( 0,M_long-l+1 ): j = i+l-1 m[i][j]...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,565
s031497082
p02234
u724923896
1453694787
Python
Python
py
Accepted
70
6512
379
n = input() M = [] def scalar(n): m = [[0 for i in range(len(n))] for j in range(len(n))] for l in range(2, len(n)+1): for i in range(0, len(n)-l+1): j = i + l - 1 m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] for k in range(i, j)) print m[0][len(n)-1] for i in ran...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,566
s901317596
p02234
u563876281
1453807676
Python
Python
py
Accepted
70
6568
384
n = input() X = [] def matrix(n): x = [[0 for i in range(len(n))] for j in range(len(n))] for l in range(2, len(n)+1): for i in range(0, len(n)-l+1): j = i + l - 1 x[i][j] = min(x[i][k] + x[k+1][j] + X[i][0]*X[k][1]*X[j][1] for k in range(i, j)) print x[0][len(n)-1] for i in...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,567
s584334600
p02234
u619765879
1453812420
Python
Python
py
Accepted
90
6572
416
n = input() p = [0 for row in range(101)] m = [[0 for col in range(n+1)] for row in range(n+1)] for i in range(1, n+1): p[i-1], p[i] = map(int, raw_input().split()) for l in range(2, n+1): for i in range(1, n-l+2): j = i + l - 1 m[i][j] = 10000000000000000 for k in range(i, j): if m[i][j]>m[i][k]...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,568
s782038135
p02234
u334643297
1453813805
Python
Python
py
Accepted
70
6568
384
n = input() M = [] def scalar(n): m = [[0 for i in range(len(n))] for j in range(len(n))] for l in range(1, len(n)): for i in range(0, len(n)-l): j = i + l m[i][j] = min(m[i][k] + m[k+1][j] + M[i][0]*M[k+1][0]*M[j][1] for k in range(i, j)) return m[0][len(n)-1] for i in rang...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,569
s304038934
p02234
u424209323
1453816960
Python
Python
py
Accepted
80
6480
414
def mcm(M): n = len(M) m = [[0 for i in range(n)] for j in range(n)] for l in range(2, n+1): for i in range(0, n-l+1): j = i + l - 1 def cost(i, k ,j): return m[i][k] + m[k+1][j] + M[i][0]*M[k][1]*M[j][1] m[i][j] = min(cost(i, k, j) for k in range(i, j)) return m[0][n-1] ...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,570
s466992438
p02234
u424209323
1453818139
Python
Python
py
Accepted
60
6472
387
def matrix(n): x = [[0 for i in range(len(n))] for j in range(len(n))] for l in range(2, len(n)+1): for i in range(0, len(n)-l+1): j = i + l - 1 x[i][j] = min(x[i][k] + x[k+1][j] + X[i][0]*X[k][1]*X[j][1] for k in range(i, j)) print x[0][len(n)-1] n = input() X = [] for i ...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,571
s753065730
p02234
u424209323
1453818963
Python
Python
py
Accepted
70
6568
387
def matrix(X): x = [[0 for i in range(len(X))] for j in range(len(X))] for l in range(2, len(X)+1): for i in range(0, len(X)-l+1): j = i + l - 1 x[i][j] = min(x[i][k] + x[k+1][j] + X[i][0]*X[k][1]*X[j][1] for k in range(i, j)) print x[0][len(X)-1] n = input() X = [] for i ...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,572
s022750698
p02234
u424209323
1453819273
Python
Python
py
Accepted
70
6520
388
def matrix(X): m = [[0 for i in range(len(X))] for j in range(len(X))] for l in range(2, len(X)+1): for i in range(0, len(X)-l+1): j = i + l - 1 m[i][j] = min(m[i][k] + m[k+1][j] + X[i][0]*X[k][1]*X[j][1] for k in range(i, j)) print m[0][len(X)-1] n = input() X = [] for i...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,573
s564826000
p02234
u424209323
1453819443
Python
Python
py
Accepted
70
6584
398
def matrix(X): m = [[0 for i in range(len(X))] for j in range(len(X))] for l in range(2, len(X) + 1): for i in range(0, len(X) - l + 1): j = i + l - 1 m[i][j] = min(m[i][k] + m[k + 1][j] + X[i][0]*X[k][1]*X[j][1] for k in range(i, j)) print m[0][len(X) - 1] n = input() X =...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,574
s363219935
p02234
u341533698
1454958629
Python
Python
py
Accepted
80
6508
561
def main(): n = int(raw_input()) m = [ [0] * n for _ in xrange(n)] p = [ 0 for _ in xrange(n+1)] for i in xrange(n): a = map(int, raw_input().split()) if i == 0: p[0] = a[0] p[1] = a[1] else: p[i+1] = a[1] for l in xrange(2,n+1): f...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,575
s468448537
p02234
u567281053
1461435969
Python
Python
py
Accepted
70
6516
537
import sys def multiply(M, N, memo): for i in range(1, N): for s in range(N - i): l, r = s, s + i mincost = 1000000 for j in range(l, r): mincost = min(mincost, memo[l][j] + memo[j + 1][r] + M[l][0] * M[j + 1][0] * M[r][1]) memo[l][r] = mincos...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,576
s003825576
p02234
u567281053
1461436491
Python
Python
py
Accepted
70
6552
438
import sys def multiply(M, N, memo): for i in range(1, N): for l in range(N - i): r = l + i memo[l][r] = min(memo[l][j] + memo[j + 1][r] + M[l][0] * M[j + 1][0] * M[r][1] for j in range(l, r)) lines = sys.stdin.readlines() del lines[0] M = [] for line in lines: M.append(map(int...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,577
s390169268
p02234
u685815919
1473225133
Python
Python
py
Accepted
90
6580
512
import sys def dp(n, size): list = [[sys.maxint for i in range(n)] for j in range(n)] for i in range(n): list[i][i] = 0 for l in range(2, n+1): for i in range(0, n-l+1): for it in range(1, l): list[i][i+l-1] = min(list[i][i+l-1], list[i][i+it-1] + list[i+it][i+l-1] + size[i]*size[i+it]*size...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,578
s391803709
p02234
u150984829
1519864539
Python
Python3
py
Accepted
100
5720
334
def s(): n=int(input())+1 e=[input().split()for _ in[0]*~-n] p=[int(e[0][0])]+list(int(x[1])for x in e) m=[[0]*n for _ in[0]*n] for i in range(n): for r in range(n-i-1): c=r+i+1 for j in range(r+1,c): x=m[r][j]+m[j][c]+p[r]*p[j]*p[c] if 1>m[r][c]or m[r][c]>x:m[r][c]=x print(m[r][c]) if'__main__'=...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,579
s362613339
p02234
u150984829
1519864542
Python
Python3
py
Accepted
100
5716
334
def s(): n=int(input())+1 e=[input().split()for _ in[0]*~-n] p=[int(e[0][0])]+list(int(x[1])for x in e) m=[[0]*n for _ in[0]*n] for i in range(n): for r in range(n-i-1): c=r+i+1 for j in range(r+1,c): x=m[r][j]+m[j][c]+p[r]*p[j]*p[c] if 1>m[r][c]or m[r][c]>x:m[r][c]=x print(m[r][c]) if'__main__'=...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,580
s188831371
p02234
u150984829
1519864581
Python
Python3
py
Accepted
100
5724
351
import sys def s(): n=int(input())+1 e=list(map(lambda x:x.split(),sys.stdin)) p=[int(e[0][0])]+list(int(x[1])for x in e) m=[[0]*n for _ in[0]*n] for i in range(n): for r in range(n-i-1): c=r+i+1 for j in range(r+1,c): x=m[r][j]+m[j][c]+p[r]*p[j]*p[c] if 1>m[r][c]or m[r][c]>x:m[r][c]=x print(m[r][...
p02234
<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>Matrix-chain Multiplication...
6 30 35 35 15 15 5 5 10 10 20 20 25
15125
28,581