Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Yawn-Sean/Daily_CF_Problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Yawn-Sean committed Mar 6, 2024
2 parents e8dd07e + 6bd88c2 commit 10d5a9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions daily_problems/2024/03/0306/solution/cf621e.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $$dp_{i+1}=A\ dp_i$$

于是,

$$dp_n=A\,dp_{n-1}=A(A\,dp_{n-2})=A^2dp_{n-2}=\dots=A^ndp_0$$
$$dp_n=A\ dp_{n-1}=A(A\ dp_{n-2})=A^2dp_{n-2}=\dots=A^ndp_0$$

我们只需要快速求出 $A^n$ 即可。这点我们可以使用类似于快速幂的矩阵快速幂,用 $A^{2^k}$ 的乘积表示 $A^n$ 进行计算即可。(由于矩阵乘法具有结合律)

Expand All @@ -35,4 +35,4 @@ def main():
v = n % (k + 1)
print('Alice' if v % 3 or v == k else 'Bob')
return
```
```

0 comments on commit 10d5a9e

Please sign in to comment.