From ae5aa68030b80d9e4918997075ee8922718eef8d Mon Sep 17 00:00:00 2001 From: AC_Oier Date: Mon, 17 Jan 2022 11:07:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8style:=20Modify=20382?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" "b/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" index 224e8b69..b3cc52a9 100644 --- "a/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" +++ "b/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" @@ -45,7 +45,7 @@ Tag : 「线性 DP」、「矩阵快速幂」 --- -## 线性 DP +### 线性 DP **定义 $f[i][j]$ 为考虑长度为 $i + 1$ 的字符串,且结尾元素为 $j$ 的方案数(其中 $j$ 代表数组 `['a', 'e', 'i', 'o', 'u']` 下标)。** From c7b3018d985d6167a524ddfa15a7da71f256a38b Mon Sep 17 00:00:00 2001 From: AC_Oier Date: Mon, 17 Jan 2022 11:12:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8style:=20Modify=201220?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\256\357\274\210\345\233\260\351\232\276\357\274\211.md" | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git "a/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" "b/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" index b3cc52a9..31467f6b 100644 --- "a/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" +++ "b/LeetCode/1211-1220/1220. \347\273\237\350\256\241\345\205\203\351\237\263\345\255\227\346\257\215\345\272\217\345\210\227\347\232\204\346\225\260\347\233\256\357\274\210\345\233\260\351\232\276\357\274\211.md" @@ -116,7 +116,8 @@ class Solution { } ``` - -```Python3 + +```Python MOD = int(1e9) + 7 class Solution: def countVowelPermutation(self, n: int) -> int: @@ -130,6 +131,7 @@ class Solution: return (((((f[-1][0] + f[-1][1]) % MOD + f[-1][2]) % MOD + f[-1][3]) % MOD) + f[-1][4]) % MOD ``` - + ```Go const MOD int = 1e9 + 7 func countVowelPermutation(n int) int { @@ -363,7 +365,7 @@ class Solution { } ``` - -```Python3 +```python import numpy as np MOD = 10 ** 9 + 7 dtype = np.dtype('uint64')