Skip to content

Commit

Permalink
update ppt
Browse files Browse the repository at this point in the history
  • Loading branch information
wujunwei committed Jan 11, 2021
1 parent 3146e26 commit b92f676
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 35 deletions.
9 changes: 5 additions & 4 deletions content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ auto_animate = true
---

$$
O(1)<O(\log_2{N})<O(N^2)<O(2^N)<O(N!)
O(1)<O(\log_2{N})<O(N)<O(N^2)<O(2^N)<O(N!)
$$

|输入数据长度|可接受复杂度|
|:----:|:----:|
|$10^{6}$|$O(N)$|
|$10^{5}$|$O(N\log_2{N})$|
|1000|$N^{2}$|
|$≤10^{9}$|$O(\log_2{N})$|
|$≤10^{6}$|$O(N)$|
|$≤10^{5}$|$O(N\log_2{N})$|
|$≤1000$|$N^{2}$|
---

![](/images/sort.png)
Expand Down
7 changes: 4 additions & 3 deletions content/bit/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,16 @@ func singleNumber(nums []int) int {
int xor = 0;
for (int num : nums) {
xor ^= num;
}
}
//xor=3^5(101^1001=1100)

---

第二步:
取异或值最后一个二进制位为 1 的数字作为 mask,如果是 1 则表示两个数字在这一位上不同
取异或值最后一个二进制位为 1 的数字作为 mask,表示两个数字在这一位上不同

int mask = xor & (-xor);
int mask = xor & (-xor);//mask = 2(10)

---

Expand Down
26 changes: 13 additions & 13 deletions content/example/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@ theme="beige"
输入: 45 67
输出: 112
```
---


{{% section %}}

![](/images/img.png)

---

![](/images/img2.png)

{{% /section %}}

---

Expand Down Expand Up @@ -154,7 +142,7 @@ func main() {

---

### 文言文(https://github.com/wenyan-lang/wenyan)
### 文言([编程语言:文言文](https://github.com/wenyan-lang/wenyan))

```文言文
施「require('fs').readFileSync」於「「/dev/stdin」」。名之曰「數據」。
Expand All @@ -172,5 +160,17 @@ func main() {

---

{{% section %}}

![](/images/img.png)

---

![](/images/img2.png)

{{% /section %}}

---

#### [返回](/#/4)

16 changes: 4 additions & 12 deletions content/game/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,19 @@ theme="beige"
---


A和B用几堆石子在做游戏。 游戏以谁手中的石子最多来决出胜负。石子的总数是奇数,所以没有平局。
A和B轮流进行,A先开始。 每回合,玩家从行的开始或结束处取走整堆石头。 直到取完为止,此时手中石子最多的玩家获胜。
假设A和B都发挥出最佳水平,当A赢得比赛时返回true,否则返回false。
拜登和川普用偶数堆石子在做游戏,以谁手中的石子最多来决出下届总统。石子的总数是奇数,所以没有平局。
拜登和川普轮流进行,拜登先开始。 每回合,两人从行的开始或结束处取走整堆石头。 直到取完为止,此时手中石子最多的玩家获胜。
假设拜登和川普都发挥出最佳水平,当拜登必胜时返回true,否则返回false。

```
输入:[5,3,4,5]
输出:true
解释:
A先开始,只能拿前 5 颗或后 5 颗石子 。
假设他取了前 5 颗,这一行就变成了 [3,4,5] 。
如果B拿走前 3 颗,那么剩下的是 [4,5],A拿走后 5 颗赢得 10 分。
如果B拿走后 5 颗,那么剩下的是 [3,4],A拿走后 4 颗赢得 9 分。
这表明,取前 5 颗石子对A来说是一个胜利的举动,所以我们返回 true 。
```
---

### answer 1

$$
dp[i][j]=max(piles[i]−dp[i+1][j],piles[j]−dp[i][j−1])
$$
$dp[i][j]=max(piles[i]−dp[i+1][j],piles[j]−dp[i][j−1])$

```go
package main
Expand Down
8 changes: 5 additions & 3 deletions content/math/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ theme="beige"
输出: 2
```
```
输入: 3
输出: 3
输入: 54
输出: 267570670
解释:n=54时,共有86267571272种跳法,86267571272%1000000007=267570670
```
```
输入: 4
输出: 5
```

---

#### 💡

<ul>
Expand All @@ -48,7 +50,7 @@ $$F(n)=(F(n-1)+F(n-2))\\%1000000007$$
```go
package main
func fib(n int) int {
return (fib(n-1)+fib(n-1))%(1e9+7)
return (fib(n-1)+fib(n-2))%(1e9+7)
}
```

Expand Down

0 comments on commit b92f676

Please sign in to comment.