Skip to content

Commit a781118

Browse files
walkcccclaude
andcommitted
docs: add two Tefuda posts
"One Engine, Three Runtimes" on shipping one TypeScript engine to a browser, a Worker and JavaScriptCore without the rules drifting, and "Sorry, Scunthorpe" on what a sixteen-character name field costs — two lists, two normalisation passes, and a false positive recorded as a decision. markup.toml gains the reason a non-breaking space appears in a CJK post: goldmark's "simple" east-asian line breaks eat a soft break whose left side is CJK and whose right side is an inline code span, so those boundaries carry U+00A0, which Prettier will not wrap on. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent c7fe6a0 commit a781118

45 files changed

Lines changed: 2543 additions & 1908 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.prettierrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"printWidth": 80,
3-
"proseWrap": "always",
3+
"proseWrap": "never",
4+
"embeddedLanguageFormatting": "off",
45
"overrides": [
56
{
67
"files": "*.md",

assets/css/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ a {
406406
border: 1px solid var(--border);
407407
padding: 0.5rem 0.75rem;
408408
text-align: left;
409+
word-break: keep-all;
409410
}
410411

411412
.prose th {

config/_default/markup.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44
[goldmark.renderer]
55
unsafe = true
66

7-
# Joins hard-wrapped lines in CJK text without inserting spaces
8-
# (source markdown is prose-wrapped at 80 columns by Prettier).
7+
# Safety net for CJK: joins a hard-wrapped line without inserting a space.
8+
# Posts are no longer prose-wrapped — .prettierrc sets proseWrap "never", so
9+
# one paragraph is one source line and there are no soft breaks left to join.
10+
# This stays enabled so a hand-inserted break inside a Chinese paragraph
11+
# still renders correctly instead of leaking a stray space.
12+
#
13+
# NOTE: keep the default "simple" style. "css3draft" also swallows soft
14+
# line breaks in pure-Latin text (e.g. right after a link), gluing English
15+
# words together.
916
[goldmark.extensions.cjk]
1017
enable = true
1118
eastAsianLineBreaks = true
12-
# NOTE: keep the default "simple" style. "css3draft" also swallows soft
13-
# line breaks in pure-Latin text (e.g. right after a link), gluing
14-
# English words together.
1519

1620
[highlight]
1721
noClasses = false

content/posts/algo/digit-dp.md

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ tags:
1212

1313
## 暴力解
1414

15-
題目模版一般會長的像這樣:給定區間 \\([L, R]\\) 和一個函數 \\(f(x) \to
16-
\\{\texttt{True}, \texttt{False}\\}\\),問在 \\([L,
17-
R]\\) 之間的正整數,滿足 \\(f(x)\\) 的數量有多少?
15+
題目模版一般會長的像這樣:給定區間 \\([L, R]\\) 和一個函數 \\(f(x) \to \\{\texttt{True}, \texttt{False}\\}\\),問在 \\([L, R]\\) 之間的正整數,滿足 \\(f(x)\\) 的數量有多少?
1816

19-
現在我們可以帶入一個真實的例子,在 \\([L = 19, R =
20-
9999]\\) 區間,每一位數的總合為 \\(k = 23\\) 的數字共有幾個?
17+
現在我們可以帶入一個真實的例子,在 \\([L = 19, R = 9999]\\) 區間,每一位數的總合為 \\(k = 23\\) 的數字共有幾個?
2118

2219
暴力解用 C++ 代碼演示如下:
2320

@@ -57,14 +54,9 @@ $$
5754
5855
那麼,該如何優化呢?首先定義:
5956
60-
> \\(S(R, k)\\):在 \\([0, R]\\) 滿足 \\(f(x) =
61-
> k\\) 的數量,其中 \\(f(x)\\) 為 \\(x\\) 的數字總合。
57+
> \\(S(R, k)\\):在 \\([0, R]\\) 滿足 \\(f(x) = k\\) 的數量,其中 \\(f(x)\\) 為 \\(x\\) 的數字總合。
6258
63-
可以推出,\\(S(R) - S(L - 1)\\) 為在 \\([L, R]\\) 滿足 \\(f(x) \to
64-
\texttt{True}\\) 的數量。並且觀察因為 \\(R =
65-
9999\\),任何滿足條件的值最多只會有 \\(n =
66-
4\\) 位數。現在我們試著將題目變成子問題:若在第一位填上
67-
`i _ _ _`,會發現在剩下的 \\(n - 1 = 3\\) 位數中,剩下 \\(k - i\\) 的餘額。
59+
可以推出,\\(S(R) - S(L - 1)\\) 為在 \\([L, R]\\) 滿足 \\(f(x) \to \texttt{True}\\) 的數量。並且觀察因為 \\(R = 9999\\),任何滿足條件的值最多只會有 \\(n = 4\\) 位數。現在我們試著將題目變成子問題:若在第一位填上 `i _ _ _`,會發現在剩下的 \\(n - 1 = 3\\) 位數中,剩下 \\(k - i\\) 的餘額。
6860
6961
現在我們定義 \\(dp(n, k)\\):在 \\(n\\) 位數當中,滿足 \\(f\\) 的數量,可得:
7062
@@ -74,19 +66,11 @@ $$
7466
7567
並且定義終止條件:\\(dp(0, 0) = 1\\)。
7668
77-
但這出現了一個問題,若 \\(R\\) 不等於 \\(10^n -
78-
1\\) 的值,那麼不能考慮所有 \\(n\\) 為數的數字,舉例來說,若 \\(R =
79-
3456\\),則我們不能考慮所有 4 位數的字,更具體的說,任何在 \\([3457,
80-
9999]\\) 區間滿足條件的數字都不應被計算進去,必需加入適當的條件判斷。
69+
但這出現了一個問題,若 \\(R\\) 不等於 \\(10^n - 1\\) 的值,那麼不能考慮所有 \\(n\\) 為數的數字,舉例來說,若 \\(R = 3456\\),則我們不能考慮所有 4 位數的字,更具體的說,任何在 \\([3457, 9999]\\) 區間滿足條件的數字都不應被計算進去,必需加入適當的條件判斷。
8170
82-
我們可以加入一個 `isTight`
83-
的布林值,判斷當前這一位數應不應該遵守開區間的邊界規範,重新定義 \\(dp(n, k,
84-
\texttt{isTight})\\),對於題目 \\(S(R, k) = S(3456,
85-
k)\\),我們可以針對在首位數填上不同數字分成以下三種情形討論:
71+
我們可以加入一個 `isTight` 的布林值,判斷當前這一位數應不應該遵守開區間的邊界規範,重新定義 \\(dp(n, k, \texttt{isTight})\\),對於題目 \\(S(R, k) = S(3456, k)\\),我們可以針對在首位數填上不同數字分成以下三種情形討論:
8672
87-
- 填上 \\(<
88-
3\\) 的數字,那麼剩下的 3 位數不再需要遵守邊界規範,可以自由的填上 \\([0,
89-
999]\\) 而不會超過 \\(3456\\)。
73+
- 填上 \\(< 3\\) 的數字,那麼剩下的 3 位數不再需要遵守邊界規範,可以自由的填上 \\([0, 999]\\) 而不會超過 \\(3456\\)。
9074
- 填上 \\(3\\),那麼剩下的三位數還是必需遵守邊界規範 \\([0, 456]\\)。
9175
- 顯然地,我們不能在第一位數填上 \\(> 3\\) 的任何數字。
9276

content/posts/algo/lc-1453.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ tags:
1919

2020
以下提供的解法:
2121

22-
1. 枚舉所有點對 \\((P,
23-
Q)\\),找出與 \\(P\\)、\\(Q\\) 相切的兩個圓 \\(C_1\\) 和 \\(C_2\\):\\(O(n^2)\\)
22+
1. 枚舉所有點對 \\((P, Q)\\),找出與 \\(P\\)、\\(Q\\) 相切的兩個圓 \\(C_1\\) 和 \\(C_2\\):\\(O(n^2)\\)
2423
1. 檢查其它所有點是否在 \\(C_1\\) 和 \\(C_2\\) 間:\\(O(n)\\)
2524
1. 總時間:\\(O(n^3)\\)
2625

content/posts/engineering-zestimer-and-furioke.md

Lines changed: 0 additions & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)