-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
973e3d5
commit be86f57
Showing
2 changed files
with
47 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
## ✏️ 기록 | ||
|
||
| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | | ||
| :---: | :--------: | :------: | :------------------------------------------------: | :-------------------------------------------------------: | | ||
| 1차시 | 2024.03.11 | 스택 | [쇠막대기](https://www.acmicpc.net/problem/10799) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/2) | | ||
| 2차시 | 2024.03.16 | BFS | [토마토](https://www.acmicpc.net/problem/7576) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/7) | | ||
| 3차시 | 2024.03.19 | BFS | [토마토](https://www.acmicpc.net/problem/7569) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/9) | | ||
| 4차시 | 2024.03.25 | BFS | [숨바꼭질3](https://www.acmicpc.net/problem/13549) | [#17](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/9) | | ||
| 5차시 | 2024.03.30 | BFS | [점프점프](https://www.acmicpc.net/problem/11060) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/9) | | ||
| 6차시 | 2024.04.02 | 스택 | [문자열폭발](https://www.acmicpc.net/problem/9935) | [#26](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/25) | | ||
| 차시 | 날짜 | 문제유형 | 링크 | 풀이 | | ||
| :----: | :--------: | :--------: | :-----------------------------------------------------: | :-------------------------------------------------------: | | ||
| 1차시 | 2024.03.11 | 스택 | [쇠막대기](https://www.acmicpc.net/problem/10799) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/2) | | ||
| 2차시 | 2024.03.16 | BFS | [토마토](https://www.acmicpc.net/problem/7576) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/7) | | ||
| 3차시 | 2024.03.19 | BFS | [3차원토마토](https://www.acmicpc.net/problem/7569) | [#3](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/11) | | ||
| 4차시 | 2024.03.25 | BFS | [숨바꼭질3](https://www.acmicpc.net/problem/13549) | [#4](https://github.com/AlgoLeadMe/AlgoLeadMe8/pull/16) | | ||
| 5차시 | 2024.03.30 | BFS | [점프점프](https://www.acmicpc.net/problem/11060) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/23) | | ||
| 6차시 | 2024.04.02 | 스택 | [문자열폭발](https://www.acmicpc.net/problem/9935) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/25) | | ||
| 7차시 | 2024.04.05 | 스택 | [오큰수](https://www.acmicpc.net/problem/17298) | [#7](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/30) | | ||
| 8차시 | 2024.04.12 | BFS | [결혼식](https://www.acmicpc.net/problem/5567) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/37) | | ||
| 9차시 | 2024.04.29 | DP | [1,2,3 더하기 3](https://www.acmicpc.net/problem/15988) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/38) | | ||
| 10차시 | 2024.05.07 | 수학 | [연속 합](https://www.acmicpc.net/problem/2737) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/43) | | ||
| 11차시 | 2024.05.07 | DP | [합분해](https://www.acmicpc.net/problem/2225) | [#11](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/44) | | ||
| 12차시 | 2024.05.13 | 브루트포스 | [암호만들기](https://www.acmicpc.net/problem/1759) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/50) | | ||
| 13차시 | 2024.05.23 | 분할정복 | [피보나치 수 6](https://www.acmicpc.net/problem/11444) | [#13](https://github.com/AlgoLeadMe/AlgoLeadMe-8/pull/54) | | ||
|
||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
def matrixmult(A, B, mod): # 행렬 곱 계산 | ||
n = len(A) | ||
C = [[0] * n for _ in range(n)] | ||
for i in range(n): | ||
for j in range(n): | ||
for k in range(n): | ||
C[i][j] += A[i][k] * B[k][j] | ||
C[i][j] %= mod | ||
return C | ||
|
||
def matrixpow(M, N, mod): # 행렬 거듭제곱 계산 (M의 N승) | ||
n = len(M) | ||
result = [[1 if i == j else 0 for j in range(n)] for i in range(n)] # 단위 행렬 | ||
base = M | ||
|
||
while N: # N이 0이 될 때까지 반복 | ||
if N % 2 == 1: | ||
result = matrixmult(result, base, mod) | ||
base = matrixmult(base, base, mod) | ||
N //= 2 | ||
|
||
return result | ||
|
||
mod = 1000000007 | ||
|
||
M = [[1, 1], | ||
[1, 0]] | ||
|
||
n = int(input()) | ||
|
||
result = matrixpow(M, n-1, mod) | ||
print(result[0][0]) |