baekjoon 20260128
This commit is contained in:
parent
507cba2f3b
commit
2c88249a7b
1
code_study/Baekjoon/python/10569.py
Normal file
1
code_study/Baekjoon/python/10569.py
Normal file
@ -0,0 +1 @@
|
||||
print('\n'.join(list(map(str, [(lambda x : 2 - x[0] + x[1])(list(map(int, input().split()))) for _ in range(int(input()))]))))
|
||||
11
code_study/Baekjoon/python/11053.py
Normal file
11
code_study/Baekjoon/python/11053.py
Normal file
@ -0,0 +1,11 @@
|
||||
N = int(input())
|
||||
A = list(map(int, input().split()))
|
||||
|
||||
dp = [1]*N
|
||||
|
||||
for i in range(N) :
|
||||
for j in range(i) :
|
||||
if(A[i] > A[j]) :
|
||||
dp[i] = max(dp[i], dp[j] + 1)
|
||||
|
||||
print(max(dp))
|
||||
26
code_study/Baekjoon/python/11444.py
Normal file
26
code_study/Baekjoon/python/11444.py
Normal file
@ -0,0 +1,26 @@
|
||||
MOD = 1000000007
|
||||
|
||||
def multiply_matrix(a, b) :
|
||||
result = [[0,0],[0,0]]
|
||||
|
||||
for i in range(2) :
|
||||
for j in range(2) :
|
||||
temp = 0
|
||||
for k in range(2) :
|
||||
temp += a[i][k]*b[k][j]
|
||||
result[i][j] = temp%MOD
|
||||
|
||||
return result
|
||||
|
||||
def power_matrix(adj, N) :
|
||||
if N == 1 :
|
||||
return adj
|
||||
|
||||
half = power_matrix(adj, N//2)
|
||||
|
||||
if N%2 == 0 :
|
||||
return multiply_matrix(half, half)
|
||||
else :
|
||||
return multiply_matrix(multiply_matrix(half, half), adj)
|
||||
|
||||
print(power_matrix([[1,1], [1,0]], int(input()))[1][0]%MOD)
|
||||
Loading…
x
Reference in New Issue
Block a user