[BOJ][Python]2096 풀이
https://www.acmicpc.net/problem/2096 2096번: 내려가기 첫째 줄에 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 N개의 줄에는 숫자가 세 개씩 주어진다. 숫자는 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 중의 하나가 된다. www.acmicpc.net import sys ssr = sys.stdin.readline def max_dp(): scores = [board[0][0], board[0][1], board[0][2]] dpos = (-1, 0, 1) for r in range(n): if r == n-1: break tmps = [i for i in scores] scores = [tmps[i]+board[r+1][i] for i in range(3)..
2023. 8. 22.
[BOJ][Python]11444 풀이
https://www.acmicpc.net/problem/11444 11444번: 피보나치 수 6 첫째 줄에 n이 주어진다. n은 1,000,000,000,000,000,000보다 작거나 같은 자연수이다. www.acmicpc.net def matrix_multiplication(matrix1, matrix2): result = [[0, 0], [0, 0]] for i in range(2): for j in range(2): for k in range(2): result[i][j] += matrix1[i][k]*matrix2[k][j] result[i][j] %= 1000000007 return result n = int(input()) ans = [[1, 0], [0, 1]] fib_mat = [[1,..
2023. 8. 19.