RegMs If 1 tahun lalu
induk
melakukan
57ee85f1d6
100 mengubah file dengan 162 tambahan dan 163 penghapusan
  1. 0 1
      README.md
  2. 2 2
      _config.fluid.yml
  3. 1 1
      package.json
  4. 1 1
      source/_posts/oi/another-chocolate-maniac.md
  5. 1 1
      source/_posts/oi/archipelago.md
  6. 1 1
      source/_posts/oi/arpa-and-a-game-with-mojtaba.md
  7. 1 1
      source/_posts/oi/arpa-and-a-list-of-numbers.md
  8. 1 1
      source/_posts/oi/best-edge-weight.md
  9. 1 1
      source/_posts/oi/bitwise-xor.md
  10. 2 2
      source/_posts/oi/black-white-balls.md
  11. 1 1
      source/_posts/oi/book-pile.md
  12. 1 1
      source/_posts/oi/cards-sorting.md
  13. 5 5
      source/_posts/oi/ceizenpoks-formula.md
  14. 1 1
      source/_posts/oi/choosing-balls.md
  15. 1 1
      source/_posts/oi/choosing-the-commander.md
  16. 3 3
      source/_posts/oi/clever-y.md
  17. 4 4
      source/_posts/oi/coin-troubles.md
  18. 2 2
      source/_posts/oi/colored-balls.md
  19. 1 1
      source/_posts/oi/colorful-hats.md
  20. 1 1
      source/_posts/oi/command-network.md
  21. 1 1
      source/_posts/oi/complete-the-graph.md
  22. 1 1
      source/_posts/oi/count-on-a-tree-ii.md
  23. 2 2
      source/_posts/oi/counting-divisors-square.md
  24. 3 3
      source/_posts/oi/cow-program.md
  25. 1 1
      source/_posts/oi/d-tree.md
  26. 1 1
      source/_posts/oi/destiny.md
  27. 1 1
      source/_posts/oi/digit-tree.md
  28. 1 1
      source/_posts/oi/digital-root.md
  29. 2 2
      source/_posts/oi/divisibility.md
  30. 1 1
      source/_posts/oi/dna-evolution.md
  31. 1 1
      source/_posts/oi/dna-sequence.md
  32. 1 1
      source/_posts/oi/dynamic-rankings.md
  33. 2 2
      source/_posts/oi/dzy-loves-fibonacci-numbers.md
  34. 1 1
      source/_posts/oi/dzy-loves-modification.md
  35. 1 1
      source/_posts/oi/ellipse.md
  36. 1 1
      source/_posts/oi/expensive-drink.md
  37. 1 1
      source/_posts/oi/fence.md
  38. 3 3
      source/_posts/oi/fermats-last-theorem.md
  39. 1 1
      source/_posts/oi/four-loop.md
  40. 1 1
      source/_posts/oi/fox-and-dinner.md
  41. 1 1
      source/_posts/oi/fox-and-jumping.md
  42. 2 2
      source/_posts/oi/fox-and-names.md
  43. 1 1
      source/_posts/oi/funny-strings.md
  44. 1 1
      source/_posts/oi/gcd-extreme-hard.md
  45. 1 1
      source/_posts/oi/gena-vs-petya.md
  46. 1 1
      source/_posts/oi/goodbye-souvenir.md
  47. 1 1
      source/_posts/oi/hack-it.md
  48. 1 1
      source/_posts/oi/hide.md
  49. 1 1
      source/_posts/oi/high-load.md
  50. 1 1
      source/_posts/oi/imbalanced-array.md
  51. 1 1
      source/_posts/oi/integer-sequences.md
  52. 3 3
      source/_posts/oi/introduction-to-kmp.md
  53. 1 1
      source/_posts/oi/jackpot.md
  54. 2 2
      source/_posts/oi/jumping-joe.md
  55. 1 1
      source/_posts/oi/karen-and-cards.md
  56. 1 1
      source/_posts/oi/karen-and-game.md
  57. 3 3
      source/_posts/oi/karen-and-supermarket.md
  58. 14 14
      source/_posts/oi/karen-and-test.md
  59. 2 2
      source/_posts/oi/kyoya-and-train.md
  60. 1 1
      source/_posts/oi/legacy.md
  61. 1 1
      source/_posts/oi/little-pony-and-elements-of-harmony.md
  62. 1 1
      source/_posts/oi/little-pony-and-lord-tirek.md
  63. 1 1
      source/_posts/oi/matching-names.md
  64. 4 4
      source/_posts/oi/max-and-min.md
  65. 1 1
      source/_posts/oi/meeting.md
  66. 3 3
      source/_posts/oi/memory-and-scores.md
  67. 1 1
      source/_posts/oi/minimal-labels.md
  68. 1 1
      source/_posts/oi/nearly-prime-numbers.md
  69. 3 3
      source/_posts/oi/notes-on-math-theory.md
  70. 5 5
      source/_posts/oi/notes-on-module.md
  71. 5 5
      source/_posts/oi/notes-on-multiplicative-inverse.md
  72. 1 1
      source/_posts/oi/office-keys.md
  73. 1 1
      source/_posts/oi/open-the-brackets.md
  74. 1 1
      source/_posts/oi/opening-portals.md
  75. 1 1
      source/_posts/oi/paths-in-a-complete-binary-tree.md
  76. 1 1
      source/_posts/oi/perishable-roads.md
  77. 1 1
      source/_posts/oi/petya-and-tree.md
  78. 1 1
      source/_posts/oi/picnic-cows.md
  79. 1 1
      source/_posts/oi/pishty-and-tree.md
  80. 2 2
      source/_posts/oi/primes.md
  81. 1 1
      source/_posts/oi/print-article.md
  82. 1 1
      source/_posts/oi/query-on-the-subtree.md
  83. 1 1
      source/_posts/oi/recover-path.md
  84. 2 2
      source/_posts/oi/recruiting.md
  85. 1 1
      source/_posts/oi/rectangle.md
  86. 1 1
      source/_posts/oi/repairing-company.md
  87. 1 1
      source/_posts/oi/sereja-and-subsequences.md
  88. 1 1
      source/_posts/oi/shaass-and-bookshelf.md
  89. 3 3
      source/_posts/oi/shaass-and-lights.md
  90. 2 2
      source/_posts/oi/shrinking.md
  91. 3 3
      source/_posts/oi/similarity-of-necklaces-2.md
  92. 1 1
      source/_posts/oi/skills.md
  93. 1 1
      source/_posts/oi/strange-radiation.md
  94. 1 1
      source/_posts/oi/string-reconstruction.md
  95. 1 1
      source/_posts/oi/template-of-simplex-algorithm.md
  96. 1 1
      source/_posts/oi/the-child-and-binary-tree.md
  97. 2 2
      source/_posts/oi/the-equation.md
  98. 1 1
      source/_posts/oi/the-lazy-programmer.md
  99. 1 1
      source/_posts/oi/the-sum-of-unitary-divisors.md
  100. 2 2
      source/_posts/oi/tower.md

+ 0 - 1
README.md

@@ -1,2 +1 @@
 # hexo-blog
-

+ 2 - 2
_config.fluid.yml

@@ -398,11 +398,11 @@ footer:
   # 页脚第一行文字的 HTML,建议保留 Fluid 的链接,用于向更多人推广本主题
   # HTML of the first line of the footer, it is recommended to keep the Fluid link to promote this theme to more people
   content: '
-    <span>Copyright © 2017-2022 RegMs If.</span>
+    <span>Copyright © 2017-2024 RegMs If.</span>
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a>
     <i class="iconfont icon-love"></i>
     <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a>
-  '
+    '
 
   # 展示网站的 PV、UV 统计数
   # Display website PV and UV statistics

+ 1 - 1
package.json

@@ -26,4 +26,4 @@
     "hexo-theme-landscape": "^1.0.0",
     "nunjucks": "^3.2.4"
   }
-}
+}

+ 1 - 1
source/_posts/oi/another-chocolate-maniac.md

@@ -18,7 +18,7 @@ Bob really LOVES chocolate. He thinks he never gets enough. Imagine his joy when
 
 给定一个$M \times N$的网格,其中有些格子是满的。要求用$2 \times 1$和$1 \times 2$两种方块填充空格子,使得不存在两个相邻的空格子。求至少需要多少方块。
 
-数据范围:$1 \le M \le 70, \; 1 \le N \le 7$。
+数据范围:$1 \le M \le 70, \ 1 \le N \le 7$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/archipelago.md

@@ -17,7 +17,7 @@ Archipelago Ber-Islands consists of $N$ islands that are vertices of equiangular
 
 平面上有一个正$N$边形,它的顶点按顺时针方向依次标号。给定第$N_1$、$N_2$个点的坐标$(x_1, y_1)$、$(x_2, y_2)$,求所有顶点的坐标。
 
-数据范围:$3 \le N \le 150, \; N_1 \neq N_2, \; |x_1|, |y_1|, |x_2|, |y_2| \le 2 \times 10^6$。
+数据范围:$3 \le N \le 150, \ N_1 \neq N_2, \ |x_1|, |y_1|, |x_2|, |y_2| \le 2 \times 10^6$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/arpa-and-a-game-with-mojtaba.md

@@ -22,7 +22,7 @@ Mojtaba starts the game and the players alternatively make moves. Determine whic
 
 给定一个长度为$n$的序列,两人轮流进行操作,每次操作给定$p, k$,其中$p$是素数,$k$是正整数,将序列中所有能被$p^k$整除的数除以$p^k$(要求至少有一个数能被整除),不能进行操作的人算输。问在两人都采取最优策略的情况下,先手必胜还是后手必胜。
 
-数据范围:$1 \le n \le 100, \; 1 \le a_i \le 10^9$。
+数据范围:$1 \le n \le 100, \ 1 \le a_i \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/arpa-and-a-list-of-numbers.md

@@ -29,7 +29,7 @@ Help Arpa to find the minimum possible cost to make the list good.
 
 给定一个长度为$n$的序列,第$i$个数字为$a_i$。有两种操作:删除一个数,消耗$x$;将一个数加$1$,消耗$y$。求使得序列中所有数的最大公约数大于$1$的最少消耗。
 
-数据范围:$1 \le n \le 5 \times 10^5, \; 1 \le x, y \le 10^9, \; 1 \le a_i \le 10^6$。
+数据范围:$1 \le n \le 5 \times 10^5, \ 1 \le x, y \le 10^9, \ 1 \le a_i \le 10^6$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/best-edge-weight.md

@@ -23,7 +23,7 @@ You are to determine this maximum weight described above for each edge. You shou
 
 给定一张$n$个点$m$条边的连通无向图,边权均为正数。对于每一条边,询问它的边权至多是多少,使得在其他边权不变的条件下,它在这张图的所有最小生成树中。
 
-数据范围:$2 \le n \le 2 \times 10^5, \; n-1 \le m \le 2 \times 10^5$。
+数据范围:$2 \le n \le 2 \times 10^5, \ n-1 \le m \le 2 \times 10^5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/bitwise-xor.md

@@ -18,7 +18,7 @@ Given a sequence $a$ and an empty sequence $b$, each element in $a$ is added
 
 给定一个长度为$n$的序列$a$,其中每个数都有$P$的概率被选中。令被选中的数的异或和为$s$。求$s^2$的期望。
 
-数据范围:$1 \le n \le 10^5, \; 0 \le a_i \lt 10^9+7$
+数据范围:$1 \le n \le 10^5, \ 0 \le a_i \lt 10^9+7$
 
 ## 算法分析
 

+ 2 - 2
source/_posts/oi/black-white-balls.md

@@ -23,7 +23,7 @@ You are given $n, l_1, l_2$ and $p$, and you must find such $a$ and $b$ that $b-
 
 袋子里有$n$个球,每个球可能是黑色或白色。已知黑球个数在$0, 1, \ldots, n$之间等概率分布。现在从中取出$l$个球,其中有$l_1$个黑球和$l_2$个白球($l_1+l_2=l$)。要求找到一个最短的区间$[a, b]$,使得黑球个数在$[a, b]$中的概率至少为${p \over 100}$。若有多个这样的区间,输出$a$最小的。
 
-数据范围:$1 \le n \le 50, \; 0 \le l_1 \le n, \; 0 \le l_2 \le n-l_1, \; 0 \le p \le 100$。
+数据范围:$1 \le n \le 50, \ 0 \le l_1 \le n, \ 0 \le l_2 \le n-l_1, \ 0 \le p \le 100$。
 
 ## 算法分析
 
@@ -36,7 +36,7 @@ $$
 而我们知道
 
 $$
-P(B_i)={1 \over n+1}, \; P(A|B_i)={ {i \choose l_1}{n-i \choose l_2} \over {n \choose l}}
+P(B_i)={1 \over n+1}, \ P(A|B_i)={ {i \choose l_1}{n-i \choose l_2} \over {n \choose l}}
 $$
 
 因此可以计算出$P(B_i|A)$,接下来只要枚举区间即可。

+ 1 - 1
source/_posts/oi/book-pile.md

@@ -25,7 +25,7 @@ The maximum number of books is no more than $40000$. All book names are non-empt
 
 桌上有$N$本书叠成一堆。有两种操作:① 往书堆上加一本书;② 将最顶上的$K$本书翻转(若不足$K$本则全部翻转)。求操作$M$次后书本的顺序。
 
-数据范围:$0 \le N \le 40000, \; 0 \le M \le 10^5, \; 0 \le K \le 40000$。
+数据范围:$0 \le N \le 40000, \ 0 \le M \le 10^5, \ 0 \le K \le 40000$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/cards-sorting.md

@@ -22,7 +22,7 @@ You are to determine the total number of times Vasily takes the top card from th
 
 有$n$张卡牌,第$i$张卡牌上的数字为$a_i$。每次从牌堆顶拿一张牌,如果它上面的数字是当前牌堆中最小的,则将它扔掉,否则将它放到牌堆底。问几次操作后牌堆为空。
 
-数据范围:$1 \le n \le 10^5, \; 1 \le a_i \le 10^5$。
+数据范围:$1 \le n \le 10^5, \ 1 \le a_i \le 10^5$。
 
 ## 算法分析
 

+ 5 - 5
source/_posts/oi/ceizenpoks-formula.md

@@ -24,14 +24,14 @@ While the whole Universe is trying to guess what the formula is useful for, we n
 
 求${n \choose k} \bmod m$。
 
-数据范围:$1 \le n \le 10^{18}, \; 0 \le k \le n, \; 2 \le m \le 10^6$。
+数据范围:$1 \le n \le 10^{18}, \ 0 \le k \le n, \ 2 \le m \le 10^6$。
 
 ## 算法分析
 
 
 $$
-x={n \choose k}, \; m=p_1^{a_1}p_2^{a_2} \cdots p_q^{a_q}
+x={n \choose k}, \ m=p_1^{a_1}p_2^{a_2} \cdots p_q^{a_q}
 $$
 
 可以列出方程组
@@ -55,7 +55,7 @@ $$
 {n \choose k}={n! \over k!(n-k)!}
 $$
 
-那么只要求出$n! \bmod p_i^{a_i}, \; k! \bmod p_i^{a_i}, \; (n-k)! \bmod p_i^{a_i}$的值,就可以用逆元求出${n \choose k} \bmod p_i^{a_i}$。
+那么只要求出$n! \bmod p_i^{a_i}, \ k! \bmod p_i^{a_i}, \ (n-k)! \bmod p_i^{a_i}$的值,就可以用逆元求出${n \choose k} \bmod p_i^{a_i}$。
 
 对于如何求$n! \bmod p_i^{a_i}$,令
 
@@ -66,10 +66,10 @@ $$
 由$x \equiv x+p_i^{a_i} \pmod{p_i^{a_i}}$,可得
 
 $$
-f(n)=\left(f\left(\left\lfloor{n \over p_i}\right\rfloor\right)\cdot p_i^{\lfloor n/p_i \rfloor}\cdot\left(\prod_{i \in [1, p_i^{a_i}], \; p_i\not\mid i}i\right)^{\lfloor n/p_i^{a_i} \rfloor}\cdot\prod_{i \in [1, n \bmod p_i^{a_i}], \; p_i\not\mid i}i\right)\bmod p_i^{a_i}
+f(n)=\left(f\left(\left\lfloor{n \over p_i}\right\rfloor\right)\cdot p_i^{\lfloor n/p_i \rfloor}\cdot\left(\prod_{i \in [1, p_i^{a_i}], \ p_i\not\mid i}i\right)^{\lfloor n/p_i^{a_i} \rfloor}\cdot\prod_{i \in [1, n \bmod p_i^{a_i}], \ p_i\not\mid i}i\right)\bmod p_i^{a_i}
 $$
 
-但是$k!, \; (n-k)!$在模$p_i^{a_i}$意义下可能不存在逆元,因此需要将$n!, \; k!, \; (n-k)!$中的$p_i$因子提取出来,求出逆元后再乘回去。
+但是$k!, \ (n-k)!$在模$p_i^{a_i}$意义下可能不存在逆元,因此需要将$n!, \ k!, \ (n-k)!$中的$p_i$因子提取出来,求出逆元后再乘回去。
 
 这样就得到了所有$r_i$。用中国剩余定理求解方程组即可。
 

+ 1 - 1
source/_posts/oi/choosing-balls.md

@@ -28,7 +28,7 @@ Note that the new sequence can be empty, and the value of an empty sequence is d
 
 $n$个球排成一行,第$i$个球的颜色是$c_i$,价值是$v_i$。一个序列的价值等于与前一个球颜色相同的球的价值之和乘以$a$加其他球的价值之和乘以$b$。空序列的价值为$0$。有$q$组询问,每组询问给定$a, b$,求这$n$个球的最大价值子序列。
 
-数据范围:$1 \le c_i \le n \le 10^5, \; 1 \le q \le 500, \; 0 \le |v_i|, |a|, |b| \le 10^5$。
+数据范围:$1 \le c_i \le n \le 10^5, \ 1 \le q \le 500, \ 0 \le |v_i|, |a|, |b| \le 10^5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/choosing-the-commander.md

@@ -29,7 +29,7 @@ For each event of the third type Vova wants to know how many warriors (counting
 
 有一个初始为空的数字集合。有三种操作:① 向集合中加入一个数$p$;② 从集合中删除一个数$p$;③ 询问集合中与$p$的异或值小于$l$的数的个数。总共进行了$q$次操作。
 
-数据范围:$1 \le q \le 10^5, \; 1 \le p_i, l_i \le 10^8$。
+数据范围:$1 \le q \le 10^5, \ 1 \le p_i, l_i \le 10^8$。
 
 ## 算法分析
 

+ 3 - 3
source/_posts/oi/clever-y.md

@@ -37,7 +37,7 @@ $$
 
 特殊处理两种情况:$X, K$中至少有一个为$0$时,$Y=1$或无解;$K=1$时,$Y=0$。
 
-先考虑$(X, Z)=1$的情况。令$M=\lceil \sqrt{Z} \rceil, \; Y=aM-b \; (0 \lt a, b \le M)$,那么
+先考虑$(X, Z)=1$的情况。令$M=\lceil \sqrt{Z} \rceil, \ Y=aM-b \ (0 \lt a, b \le M)$,那么
 
 $$
 \begin{align}
@@ -48,7 +48,7 @@ $$
 
 可以在$O(M)$的时间内预处理出$K \cdot X^b$,存在哈希表中,接着$O(M)$枚举$a$,判断哈希表中是否存在$X^{aM}$,若存在,则找到解$Y=aM-b$。由于要求最小值,因此哈希表中有重复时应记录较大的$b$。
 
-下面考虑$(X, Z) \gt 1$的情况。令$D=(X, Z)$,易知若$K \nmid D$则无解。设$X=Dx, \; K=Dk, \; Z=Dz$,据同余的性质可得
+下面考虑$(X, Z) \gt 1$的情况。令$D=(X, Z)$,易知若$K \nmid D$则无解。设$X=Dx, \ K=Dk, \ Z=Dz$,据同余的性质可得
 
 $$
 \begin{align}
@@ -63,7 +63,7 @@ $$
 (Dx)^{Y-1} \equiv k \cdot x^{-1} \pmod z
 $$
 
-令$X'=Dx=X, \; Y'=Y-1, \; K'=k \cdot x^{-1}, \; Z'=z$,则
+令$X'=Dx=X, \ Y'=Y-1, \ K'=k \cdot x^{-1}, \ Z'=z$,则
 
 $$
 (X')^{Y'} \equiv K' \pmod{Z'}

+ 4 - 4
source/_posts/oi/coin-troubles.md

@@ -12,11 +12,11 @@ date: 2017-07-27 19:00:40
 
 ## 题目描述
 
-In the Isle of Guernsey there are $n$ different types of coins. For each $i \; (1 \le i \le n)$, coin of type $i$ is worth $a_i$ cents. It is possible that $a_i=a_j$ for some $i$ and $j \; (i \neq j)$.
+In the Isle of Guernsey there are $n$ different types of coins. For each $i \ (1 \le i \le n)$, coin of type $i$ is worth $a_i$ cents. It is possible that $a_i=a_j$ for some $i$ and $j \ (i \neq j)$.
 
-Bessie has some set of these coins totaling $t$ cents. She tells Jessie $q$ pairs of integers. For each $i \; (1 \le i \le q)$, the pair $b_i, c_i$ tells Jessie that Bessie has a strictly greater number of coins of type $b_i$ than coins of type $c_i$. It is known that all $b_i$ are distinct and all $c_i$ are distinct.
+Bessie has some set of these coins totaling $t$ cents. She tells Jessie $q$ pairs of integers. For each $i \ (1 \le i \le q)$, the pair $b_i, c_i$ tells Jessie that Bessie has a strictly greater number of coins of type $b_i$ than coins of type $c_i$. It is known that all $b_i$ are distinct and all $c_i$ are distinct.
 
-Help Jessie find the number of possible combinations of coins Bessie could have. Two combinations are considered different if there is some $i \; (1 \le i \le n)$, such that the number of coins Bessie has of type $i$ is different in the two combinations. Since the answer can be very large, output it modulo $1000000007$ ($10^9+7$).
+Help Jessie find the number of possible combinations of coins Bessie could have. Two combinations are considered different if there is some $i \ (1 \le i \le n)$, such that the number of coins Bessie has of type $i$ is different in the two combinations. Since the answer can be very large, output it modulo $1000000007$ ($10^9+7$).
 
 If there are no possible combinations of coins totaling $t$ cents that satisfy Bessie's conditions, output $0$.
 
@@ -24,7 +24,7 @@ If there are no possible combinations of coins totaling $t$ cents that satisfy B
 
 你有$n$种纸币,第$i$种纸币的价值为$a_i$(可能有多个$a_i$相等)。已知所有纸币的总价值为$t$。给定$q$对整数$b_i, c_i$,表示第$b_i$种纸币的数量严格大于第$c_i$种纸币的数量。所有$b_i$均不相等,所有$c_i$均不相等。求满足这些条件的方案数。
 
-数据范围:$1 \le n \le 300, \; 1 \le t \le 10^5, \; 1 \le a_i \le 10^5$。
+数据范围:$1 \le n \le 300, \ 1 \le t \le 10^5, \ 1 \le a_i \le 10^5$。
 
 ## 算法分析
 

+ 2 - 2
source/_posts/oi/colored-balls.md

@@ -24,7 +24,7 @@ Print the minimum possible number of sets.
 
 有$n$个盒子,第$i$个盒子的大小为$a_i$。每次可以将一个盒子拆分成两个盒子满足拆分后盒子的大小之和等于拆分前盒子的大小。问至少拆分成多少个盒子使得最大盒子和最小盒子的大小之差不大于$1$。
 
-数据范围:$0 \le n \le 500, \; 1 \le a_i \le 10^9$。
+数据范围:$0 \le n \le 500, \ 1 \le a_i \le 10^9$。
 
 ## 算法分析
 
@@ -36,7 +36,7 @@ Print the minimum possible number of sets.
 
 这样我们就可以判断对于某一个$r$,是否所有盒子都能够被分解成若干个$r$和若干个$(r+1)$相加。
 
-接下来的问题就是如何找到这个$r$。易知$1 \le r \le \min(a_i)$。可以发现,如果$\min(a_i)$很大,在$\sqrt{\min(a_i)}$到$\min(a_i)$中可能满足条件的$r$是很少的,而且它们都在$\min(a_i)/t \; (1 \le t \le \sqrt{\min(a_i)})$附近。事实上,我们只需要从$1$到$\sqrt{\min(a_i)}$枚举$k$,分别判断$k, \min(a_i)/k, \min(a_i)/k-1$是否满足条件,取最大值即可。
+接下来的问题就是如何找到这个$r$。易知$1 \le r \le \min(a_i)$。可以发现,如果$\min(a_i)$很大,在$\sqrt{\min(a_i)}$到$\min(a_i)$中可能满足条件的$r$是很少的,而且它们都在$\min(a_i)/t \ (1 \le t \le \sqrt{\min(a_i)})$附近。事实上,我们只需要从$1$到$\sqrt{\min(a_i)}$枚举$k$,分别判断$k, \min(a_i)/k, \min(a_i)/k-1$是否满足条件,取最大值即可。
 
 最后,如果求出了满足条件的$r$,那么每个盒子被拆分后至少有$(a_i-1)/(r+1)+1$个。
 

+ 1 - 1
source/_posts/oi/colorful-hats.md

@@ -21,7 +21,7 @@ Determine whether there exists a sequence of colors of the hats that is consiste
 
 有$N$只猫戴着帽子,每一顶帽子都有一种颜色。第$i$只猫看到了$a_i$种颜色的帽子(它看不到自己的帽子),问是否存在一种不矛盾的颜色分配方案。
 
-数据范围:$2 \le N \le 10^5, \; 1 \le a_i \le N-1$。
+数据范围:$2 \le N \le 10^5, \ 1 \le a_i \le N-1$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/command-network.md

@@ -19,7 +19,7 @@ With the situation studied to every detail, snoopy believes that the most urgent
 
 给定平面上的$N$个点,其中$M$对点$(u_i, v_i)$之间可以连一条从$u_i$到$v_i$的有向边。要求使得从$1$号点出发可以到达其他所有点,求边的长度之和的最小值。
 
-数据范围:$1 \le N \le 100, \; 1 \le M \le 10000$。
+数据范围:$1 \le N \le 100, \ 1 \le M \le 10000$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/complete-the-graph.md

@@ -19,7 +19,7 @@ The next day, ZS the Coder realized that some of the weights were erased! So he
 
 给定一张连通无向图,其中所有边的权值均为自然数。要求将所有权值为$0$的边的权值变成任意一个不大于$10^{18}$的正整数,使得从$s$到$t$的最短路径的长度为$L$。
 
-数据范围:$2 \le n \le 1000, \; 1 \le m \le 10000, \; 1 \le L \le 10^9, \; 0 \le s, t \le n-1$。
+数据范围:$2 \le n \le 1000, \ 1 \le m \le 10000, \ 1 \le L \le 10^9, \ 0 \le s, t \le n-1$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/count-on-a-tree-ii.md

@@ -24,7 +24,7 @@ We will ask you to perform the following operation:
 
 给定一棵$N$个节点的树,每个节点都有权值。有$M$次询问,每次询问给出$u, v$,求从$u$到$v$的路径上有多少种不同的权值。
 
-数据范围:$1 \le N \le 40000, \; 1 \le M \le 10^5$。
+数据范围:$1 \le N \le 40000, \ 1 \le M \le 10^5$。
 
 ## 算法分析
 

+ 2 - 2
source/_posts/oi/counting-divisors-square.md

@@ -16,7 +16,7 @@ date: 2018-01-23 08:45:47
 
 Let $\sigma_0(n)$ be the number of positive divisors of $n$.
 
-For example, $\sigma_0(1)=1, \; \sigma_0(2)=2$ and $\sigma_0(6)=4$.
+For example, $\sigma_0(1)=1, \ \sigma_0(2)=2$ and $\sigma_0(6)=4$.
 
 Let $S_2(n)=\sum_{i=1}^n \sigma_0(i^2)$.
 
@@ -34,7 +34,7 @@ Given $N$, find $S_2(N)$.
 
 设$n=\prod_{k=1}^{\omega(n)} p_k^{a_k}$,其中$p_k$表示不同质数。
 
-先来推$f(n)$。对于$n$的每个因数$d$,将$d$的某些质因子$p_k$的次数加上$a_k$得到$d'$,有$d' \nmid n, \; d' \mid n^2$。这样的方案数有$(2^{\omega(d)}-1)$种,再算上$d$本身,可得
+先来推$f(n)$。对于$n$的每个因数$d$,将$d$的某些质因子$p_k$的次数加上$a_k$得到$d'$,有$d' \nmid n, \ d' \mid n^2$。这样的方案数有$(2^{\omega(d)}-1)$种,再算上$d$本身,可得
 
 $$
 \begin{align}

+ 3 - 3
source/_posts/oi/cow-program.md

@@ -21,11 +21,11 @@ Farmer John has just given the cows a program to play with! The program contains
 
 The cows are not very good at arithmetic though, and they want to see how the program works. Please help them!
 
-You are given the sequence $a_2, a_3, \ldots, a_n$. Suppose for each $i \; (1 \le i \le n-1)$ we run the program on the sequence $i, a_2, a_3, \ldots, a_n$. For each such run output the final value of $y$ if the program terminates or $-1$ if it does not terminate.
+You are given the sequence $a_2, a_3, \ldots, a_n$. Suppose for each $i \ (1 \le i \le n-1)$ we run the program on the sequence $i, a_2, a_3, \ldots, a_n$. For each such run output the final value of $y$ if the program terminates or $-1$ if it does not terminate.
 
 ## 题意概述
 
-有一个包含$n$个数的数列,第$i$项为$a_i$。现有两个数$x=1, \; y=0$。执行以下操作
+有一个包含$n$个数的数列,第$i$项为$a_i$。现有两个数$x=1, \ y=0$。执行以下操作
 
 ```
 while (!(x <= 0  x > n)) {
@@ -36,7 +36,7 @@ while (!(x <= 0  x > n)) {
 
 给定$a_2, a_3, \ldots, a_n$,对于所有$i \in [1, n-1]$,求对数列$i, a_2, a_3, \ldots, a_n$执行操作后$y$的值。若无限循环则输出$-1$。
 
-数据范围:$2 \le n \le 2 \times 10^5, \; 1 \le a_i \le 10^9$。
+数据范围:$2 \le n \le 2 \times 10^5, \ 1 \le a_i \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/d-tree.md

@@ -22,7 +22,7 @@ Can you help them in solving this problem?
 
 给定一棵有$N$个节点的树,其中第$i$个节点的权值为$v_i$。求一个字典序最小的点对使得这两点之间路径上的点权之积模$10^6+3$等于$K$。
 
-数据范围:$1 \le N \le 10^5, \; 0 \le K \lt 10^6+3, \; 1 \le v_i \lt 10^6+3$。
+数据范围:$1 \le N \le 10^5, \ 0 \le K \lt 10^6+3, \ 1 \le v_i \lt 10^6+3$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/destiny.md

@@ -19,7 +19,7 @@ Once, Leha found in the left pocket an array consisting of $n$ integers, and in
 
 给定包含$n$个数的序列,有$q$次询问,每次询问给定$l, r, k$,求区间$[l, r]$中出现次数严格大于${r-l+1 \over k}$的最小数字。
 
-数据范围:$1 \le n, q \le 3 \times 10^5, \; 1 \le a_i \le n, \; 2 \le k \le 5$。
+数据范围:$1 \le n, q \le 3 \times 10^5, \ 1 \le a_i \le n, \ 2 \le k \le 5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/digit-tree.md

@@ -32,7 +32,7 @@ Help ZS the Coder find the number of interesting pairs!
 
 给定一棵有$n$个节点的树和一个与$10$互质的数$M$,树上每条边的权值都是小于$10$的正整数。定义$dist_{u, v}$为依次写下从$u$到$v$路径上每条边的权值所得到的数字。求满足$M \mid dist_{u, v}$的点对个数。
 
-数据范围:$2 \le n \le 10^5, \; 1 \le M \le 10^9$。
+数据范围:$2 \le n \le 10^5, \ 1 \le M \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/digital-root.md

@@ -17,7 +17,7 @@ Let $f(n)$ be a sum of digits for positive integer $n$. If $f(n)$ is one-digit n
 
 给定一个长度为$N$的数列$A_i$,求$\sum_{i=1}^N \prod_{j=1}^i A_j$的数根。
 
-数据范围:$1 \le N \le 1000, \; 1 \le A_i \le 10^9$。
+数据范围:$1 \le N \le 1000, \ 1 \le A_i \le 10^9$。
 
 ## 算法分析
 

+ 2 - 2
source/_posts/oi/divisibility.md

@@ -32,7 +32,7 @@ As usual, the King desperately wants you to help him, so stop thinking and start
 
 给定一个字符集大小不超过$10$的字符串$s$。定义一个数字是合法的,当且仅当它没有前导零,位数等于$|s|$,且它从高到低的第$i$位和第$j$位相等当且仅当$s_i=s_j$。求出所有能整除每一个合法数字的数。有$n$组数据。
 
-数据范围:$1 \le n \le 100, \; 1 \le |s| \le 14$。
+数据范围:$1 \le n \le 100, \ 1 \le |s| \le 14$。
 
 ## 算法分析
 
@@ -44,7 +44,7 @@ As usual, the King desperately wants you to help him, so stop thinking and start
 
 考虑$g$的上界。分两种情况讨论。
 
-- **引理** $\forall a \le b, \; (a, b) \mid b-a$。
+- **引理** $\forall a \le b, \ (a, b) \mid b-a$。
 
 当字符集大小小于$10$时,对于每一个$i$,总能找到一个合法的数$x$使得$x+v_i$也合法。这是因为总有一个合法的数包含$k_i$但不包含$k_i+1$。根据**引理**,$(x, x+v_i) \mid v_i$。由于$x$和$x+v_i$均合法,因此$g \mid (x, x+v_i)$,即$g \mid v_i$。所以,$g$的上界为$(v_a, v_b, \ldots, v_z)$。结合下界,$g=(v_a, v_b, \ldots, v_z)$。
 

+ 1 - 1
source/_posts/oi/dna-evolution.md

@@ -27,7 +27,7 @@ Being a developer, Innokenty is interested in bioinformatics also, so the scient
 
 给定一个只包含 ATGC 四种字符的字符串$s$。有两种操作:① 修改$s$某一位的字符;② 求以字符串$e$为循环节的无限长循环串与$s$中$[l, r]$这个区间的字符串有几个对应位置的字符相等。操作有$q$次。
 
-数据范围:$1 \le |s|, q \le 10^5, \; 1 \le |e| \le 10$。
+数据范围:$1 \le |s|, q \le 10^5, \ 1 \le |e| \le 10$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/dna-sequence.md

@@ -20,7 +20,7 @@ Suppose that DNA sequences of a species is a sequence that consist of A, C, T an
 
 给定$m$个长度不超过$10$的 DNA 片段,问所有长度为$n$的 DNA 序列中有几个不包含所有给定的 DNA 片段。
 
-数据范围:$0 \le m \le 10, \; 1 \le n \le 2 \times 10^9$。
+数据范围:$0 \le m \le 10, \ 1 \le n \le 2 \times 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/dynamic-rankings.md

@@ -27,7 +27,7 @@ Your task is to write a program for this computer, which
 
 有一个长度为$N$的数列。有$M$次操作,每次操作询问数列第$i$项到第$j$项之间的第$k$小值,或者将第$i$项修改为$t$。
 
-数据范围:$1 \le N \le 50000, \; 1 \le M \le 10000$。
+数据范围:$1 \le N \le 50000, \ 1 \le M \le 10000$。
 
 内存限制:$32$ M。
 

+ 2 - 2
source/_posts/oi/dzy-loves-fibonacci-numbers.md

@@ -14,7 +14,7 @@ date: 2017-07-20 14:20:23
 In mathematical terms, the sequence $F_n$ of Fibonacci numbers is defined by the recurrence relation:
 
 $$
-F_1=1, \; F_2=1, \; F_n=F_{n-1}+F_{n-2} \; (n \gt 2)
+F_1=1, \ F_2=1, \ F_n=F_{n-1}+F_{n-2} \ (n \gt 2)
 $$
 
 DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of $n$ integers: $a_1, a_2, \ldots, a_n$. Moreover, there are $m$ queries, each query has one of the two types:
@@ -28,7 +28,7 @@ Help DZY reply to all the queries.
 
 给定一个长度为$n$的数列,第$i$个数为$a_i$。有两种操作:① 对于$i \in [l, r]$,将$a_i$加上$F_{i-l+1}$;② 询问区间$[l, r]$内的数字之和。其中$F_i$表示 Fibonacci 数列的第$i$项。操作有$m$次。
 
-数据范围:$1 \le n, m \le 3 \times 10^5, \; 1 \le a_i \le 10^9$。
+数据范围:$1 \le n, m \le 3 \times 10^5, \ 1 \le a_i \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/dzy-loves-modification.md

@@ -25,7 +25,7 @@ DZY wants to know: what is the largest total value of pleasure he could get afte
 
 给定一个$n \times m$的矩阵,每次可以从这个矩阵中选取一行或一列,将这一行或一列的数字之和加到你的分数上,再将这一行或一列上的每个数字减去$p$。共进行$k$次操作,求分数的最大值。
 
-数据范围:$1 \le n, m \le 1000, \; 1 \le k \le 10^6, \; 1 \le p \le 100$。
+数据范围:$1 \le n, m \le 1000, \ 1 \le k \le 10^6, \ 1 \le p \le 100$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/ellipse.md

@@ -37,7 +37,7 @@ $$
 但这样的精度并不是很高。考虑二分,令
 
 $$
-g(l, r)=\int_l^r f(x) \, {\rm d}x, \; h(l, r)={r-l \over 6} \left(f(l)+4f\left({l+r \over 2}\right)+f(r)\right)
+g(l, r)=\int_l^r f(x) \, {\rm d}x, \ h(l, r)={r-l \over 6} \left(f(l)+4f\left({l+r \over 2}\right)+f(r)\right)
 $$
 
 当$h(l, r)$与$h\left(l, {l+r \over 2}\right)+h\left({l+r \over 2}, r\right)$的差足够小时,令

+ 1 - 1
source/_posts/oi/expensive-drink.md

@@ -11,7 +11,7 @@ date: 2017-06-08 01:00:17
 
 ## 题意概述
 
-已知$0 \le c_1 \le c_2 \le c_3, \; 0 \le c_4, \; L \le a_4c_4 \le R$。$c_1, c_2, c_3, c_4$均为未知的常量。
+已知$0 \le c_1 \le c_2 \le c_3, \ 0 \le c_4, \ L \le a_4c_4 \le R$。$c_1, c_2, c_3, c_4$均为未知的常量。
 
 给出$L, R$和$n$组$a_1, a_2, a_3, p$,对于任意一组均满足$p=a_1c_1+a_2c_2+a_3c_3+a_4c_4$。现在给出一组$a_1, a_2, a_3$,求$p$的最大值。
 

+ 1 - 1
source/_posts/oi/fence.md

@@ -22,7 +22,7 @@ Write a program that determines the total maximal income obtained by the $K$ wor
 
 $K$个工人要粉刷一面长度为$N$的篱笆,第$i$个工人要么不粉刷,要么粉刷一段连续且长度不超过$L_i$的包含第$S_i$块木板的篱笆,他每粉刷一块木板可以获得$P_i$的报酬。每一块木板要么不被粉刷,要么仅被一个工人粉刷。求所有工人获得的总报酬的最大值。
 
-数据范围:$1 \le K \le 100, \; 1 \le N \le 16000$。
+数据范围:$1 \le K \le 100, \ 1 \le N \le 16000$。
 
 ## 算法分析
 

+ 3 - 3
source/_posts/oi/fermats-last-theorem.md

@@ -15,15 +15,15 @@ Given a positive integer $n$ and a positive prime number $p$, find $x, y$ and $z
 
 ## 题意概述
 
-给定一个整数$n$和一个质数$p$,判断方程$x^n+y^n \equiv z^n \pmod p \; (1 \le x, y, z \lt p)$是否存在整数解,若存在则给出一组解。有$T$组数据。
+给定一个整数$n$和一个质数$p$,判断方程$x^n+y^n \equiv z^n \pmod p \ (1 \le x, y, z \lt p)$是否存在整数解,若存在则给出一组解。有$T$组数据。
 
-数据范围:$1 \le T \le 1000, \; 3 \le n \le 10^6, \; 2 \le p \le 10^6$。
+数据范围:$1 \le T \le 1000, \ 3 \le n \le 10^6, \ 2 \le p \le 10^6$。
 
 ## 算法分析
 
 为了方便,以下同余方程模数均为$p$。
 
-求出$p$的原根$g$,设$x=g^{k_1}, \; y=g^{k_2}, \; z=g^{k_3}$,方程变为
+求出$p$的原根$g$,设$x=g^{k_1}, \ y=g^{k_2}, \ z=g^{k_3}$,方程变为
 
 $$
 g^{k_1n}+g^{k_2n} \equiv g^{k_3n}

+ 1 - 1
source/_posts/oi/four-loop.md

@@ -22,7 +22,7 @@ $$
 
 给定两个长度为$n$的序列$a$和$b$,求$\sum_{x=1}^n \sum_{y=1}^n \sum_{z=1}^n \sum_{w=1}^n (a_x+a_y+a_z+a_w)^{(b_x \oplus b_y \oplus b_z \oplus b_w)}$。
 
-数据范围:$1 \le n \le 10^5, \; 1 \le a_i \le 500, \; 1 \le b_i \le 500$。
+数据范围:$1 \le n \le 10^5, \ 1 \le a_i \le 500, \ 1 \le b_i \le 500$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/fox-and-dinner.md

@@ -28,7 +28,7 @@ If it is possible to distribute the foxes in the desired manner, find out a way
 
 给定$n$个数$a_i$,你需要将它们分成若干个圈,使得每个圈中至少有$3$个数,且任意两个相邻的数的和为质数。
 
-数据范围:$3 \le n \le 200, \; 2 \le a_i \le 10000$。
+数据范围:$3 \le n \le 200, \ 2 \le a_i \le 10000$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/fox-and-jumping.md

@@ -24,7 +24,7 @@ If this is possible, calculate the minimal cost.
 
 有$n$张卡片,每张卡片都有两个属性$l_i, c_i$。你需要从中选择一些卡片,使得在满足用已选卡片的$l_i$任意加减可以得到所有整数的情况下,已选卡片的$c_i$之和最小。求出这个最小值。
 
-数据范围:$1 \le n \le 300, \; 1 \le l_i \le 10^9, \; 1 \le c_i \le 10^5$。
+数据范围:$1 \le n \le 300, \ 1 \le l_i \le 10^9, \ 1 \le c_i \le 10^5$。
 
 ## 算法分析
 

+ 2 - 2
source/_posts/oi/fox-and-names.md

@@ -23,11 +23,11 @@ Lexicographical order is defined in following way. When we compare $s$ and $t$,
 
 给定$n$个字符串$name_1, name_2, name_3, \ldots, name_n$,要求你给出一张字母表,使得这些字符串是按照你所给出字母表的字典序从小到大排序的。
 
-数据范围:$1 \le n \le 100, \; 1 \le |name_i| \le 100$。
+数据范围:$1 \le n \le 100, \ 1 \le |name_i| \le 100$。
 
 ## 算法分析
 
-很明显,对于任意两个字符串$name_i, name_j \; (i \lt j)$来说,设其第一个不同字母的位置为$p$,则有$index_{name_{i, p}} \lt index_{name_{j, p}}$,其中$index_i$表示字母$i$在字母表中的位置。可以发现,这构成了一张拓扑图,进行一次拓扑排序就能解决问题。
+很明显,对于任意两个字符串$name_i, name_j \ (i \lt j)$来说,设其第一个不同字母的位置为$p$,则有$index_{name_{i, p}} \lt index_{name_{j, p}}$,其中$index_i$表示字母$i$在字母表中的位置。可以发现,这构成了一张拓扑图,进行一次拓扑排序就能解决问题。
 
 注意到其中有些字符串是另一些字符串的前缀。如果$name_i$是$name_j$的前缀($name_i \neq name_j$),且$i \gt j$,则直接输出 Impossible。
 

+ 1 - 1
source/_posts/oi/funny-strings.md

@@ -19,7 +19,7 @@ Let's consider a string of non-negative integers, containing $N$ elements. Suppo
 
 定义序列的旋转操作为将序列的最后一个元素移到最前面,定义两个序列等价当且仅当可以通过若干次旋转操作使它们相同,定义一个序列是 funny 的当且仅当将它的第一个元素加一、最后一个元素减一后得到的序列和原序列等价。要求构造一个长度为$N$、元素之和为$K$的 funny 序列(所有元素均为非负整数)。
 
-数据范围:$2 \le N \le 1000, \; 1 \le K \le 30000, \; (N, K)=1$。
+数据范围:$2 \le N \le 1000, \ 1 \le K \le 30000, \ (N, K)=1$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/gcd-extreme-hard.md

@@ -14,7 +14,7 @@ date: 2018-01-23 07:35:32
 ## 题目描述
 
 Let $G(n)=\sum_{i=1}^n \sum_{j=i+1}^n (i, j)$.
-For example, $G(1)=0, \; G(2)=(1, 2)=1, \; G(3)=(1, 2)+(1, 3)+(2, 3)=3$.
+For example, $G(1)=0, \ G(2)=(1, 2)=1, \ G(3)=(1, 2)+(1, 3)+(2, 3)=3$.
 Given $N$, find $G(N)$ **modulo** $2^{64}$.
 
 ## 题意概述

+ 1 - 1
source/_posts/oi/gena-vs-petya.md

@@ -24,7 +24,7 @@ Your task is to find the number of distinct numbers $x$ such that Petya will win
 
 给定$n$个正整数$a_i$,求有多少个非负整数$x$,满足$x$小于所有给定的数,且所有给定的数减去$x$之后的异或和为$0$。
 
-数据范围:$1 \le n \le 2 \times 10^5, \; 1 \le a_i \le 10^{18}$。
+数据范围:$1 \le n \le 2 \times 10^5, \ 1 \le a_i \le 10^{18}$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/goodbye-souvenir.md

@@ -24,7 +24,7 @@ From time to time, shapes of beads change as well as the memories. Sometimes, th
 
 给定一个长度为$n$的序列$a_i$,有$m$次操作。操作有两种:给定$p, x$,将第$p$个数修改成$x$;给定$l, r$,求$[l, r]$内每种数字的长度之和。某种数字长度的定义是该数字在区间内第一次出现的位置与最后一次出现的位置之差。
 
-数据范围:$1 \le n, m \le 10^5, \; 1 \le a_i, x \le n$。
+数据范围:$1 \le n, m \le 10^5, \ 1 \le a_i, x \le n$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/hack-it.md

@@ -32,7 +32,7 @@ This code will fail only on the test with $\sum_{i=l}^r f(i) \equiv 0 \pmod a$.
 
 ## 算法分析
 
-思路很巧妙。有一个显而易见的结论:$\forall i \in [1, 10^{18}], \; f(i)+1=f(i+10^{18})$。它有一个推论:$\forall x \in [1, 10^{18}], \; 1+\sum_{i=x}^{x+10^{18}-1} f(i)=\sum_{i=x+1}^{x+10^{18}} f(i)$。因此只要算出$t=\sum_{i=1}^{10^{18}} f(i) \bmod a$,将区间右移$a-t$单位。
+思路很巧妙。有一个显而易见的结论:$\forall i \in [1, 10^{18}], \ f(i)+1=f(i+10^{18})$。它有一个推论:$\forall x \in [1, 10^{18}], \ 1+\sum_{i=x}^{x+10^{18}-1} f(i)=\sum_{i=x+1}^{x+10^{18}} f(i)$。因此只要算出$t=\sum_{i=1}^{10^{18}} f(i) \bmod a$,将区间右移$a-t$单位。
 
 ## 代码
 

+ 1 - 1
source/_posts/oi/hide.md

@@ -17,7 +17,7 @@ date: 2018-02-20 19:10:22
 
 有一棵$N$个节点的树,每个节点都是黑色或白色。有$Q$次操作,动态修改点的颜色,询问最远黑点对之间的距离。
 
-数据范围:$1 \le N \le 10^5, \; 1 \le Q \le 5 \times 10^5$。
+数据范围:$1 \le N \le 10^5, \ 1 \le Q \le 5 \times 10^5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/high-load.md

@@ -22,7 +22,7 @@ Help Arkady to find such a way to build the network that the distance between th
 
 构造一棵有$n$个节点的树,使得这棵树恰有$k$个叶子节点,且直径最小。
 
-数据范围:$3 \le n \le 2 \times 10^5, \; 2 \le k \le n-1$。
+数据范围:$3 \le n \le 2 \times 10^5, \ 2 \le k \le n-1$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/imbalanced-array.md

@@ -38,7 +38,7 @@ $$
 
 其中$max_{i, j}$表示$a_i, a_{i+1}, a_{i+2}, \ldots, a_j$中的最大值,$min_{i, j}$表示$a_i, a_{i+1}, a_{i+2}, \ldots, a_j$中的最小值。
 
-数据范围:$1 \le n \le 10^6, \; 1 \le a_i \le 10^6$。
+数据范围:$1 \le n \le 10^6, \ 1 \le a_i \le 10^6$。
 
 ## 算法分析 1
 

+ 1 - 1
source/_posts/oi/integer-sequences.md

@@ -18,7 +18,7 @@ A sequence $A$ is called an integer sequence of length $N$ if all its elements $
 
 给定一个长度为$N$的向量$A$、两个整数$B, P$,求一个长度为$N$的向量$X$使得$A \cdot X \equiv B \pmod P$。向量中的数均为非负整数。
 
-数据范围:$1 \le N \le 100, \; 0 \le B \lt P \le 10000$。
+数据范围:$1 \le N \le 100, \ 0 \le B \lt P \le 10000$。
 
 ## 算法分析
 

+ 3 - 3
source/_posts/oi/introduction-to-kmp.md

@@ -30,7 +30,7 @@ acbacabacbacb
            ^
 ```
 
-假设我们已经求出$nxt_{12}=5, \; nxt_5=2$,当前两个指针分别指向$S_{12}$和$S_{nxt_{12}}=S_5$,求$nxt_{13}$。在这里,两个指向$S_p, S_q$的指针表示$S_{p-q+1, p}=S_{1, q}$。
+假设我们已经求出$nxt_{12}=5, \ nxt_5=2$,当前两个指针分别指向$S_{12}$和$S_{nxt_{12}}=S_5$,求$nxt_{13}$。在这里,两个指向$S_p, S_q$的指针表示$S_{p-q+1, p}=S_{1, q}$。
 
 比较两个指针的后一位。易知,若$S_{13}=S_6$,则$nxt_{13}=nxt_{12}+1=6$,可以将两个指针都向后移一位。
 
@@ -79,12 +79,12 @@ KMP 算法除了可以用于字符串匹配,还能求出一个循环串的最
 >
 > 当$(|A|) \nmid (|B|)$时,令$k=\left\lfloor {|B| \over |A|} \right\rfloor$。
 >
-> 考虑字符串$S=AB, \; T=S_{(k-1)|A|+1, |S|}$,可知$T_{1, |A|}=T_{|T|-|A|+1, |T|}=A, \; T_{1, |T|-|A|}=T_{|A|+1, |T|}=B_{(k-1)|A|+1, |B|}$。令$A'=B_{(k-1)|A|+1, |B|}, \; B'=A$,那么我们又得到了$A'B'=B'A'$的形式,此时$|A'|=|B| \bmod |A|, \; |B'|=|A|$。因此,最后一定能得到长为$(|A|, |B|)$的字符串,它是$A, B$的一个循环节,也是$AB$的一个循环节。
+> 考虑字符串$S=AB, \ T=S_{(k-1)|A|+1, |S|}$,可知$T_{1, |A|}=T_{|T|-|A|+1, |T|}=A, \ T_{1, |T|-|A|}=T_{|A|+1, |T|}=B_{(k-1)|A|+1, |B|}$。令$A'=B_{(k-1)|A|+1, |B|}, \ B'=A$,那么我们又得到了$A'B'=B'A'$的形式,此时$|A'|=|B| \bmod |A|, \ |B'|=|A|$。因此,最后一定能得到长为$(|A|, |B|)$的字符串,它是$A, B$的一个循环节,也是$AB$的一个循环节。
 
 - **引理 3** 若字符串$S$是循环串,则$S$的最小循环节是$S_{1, i-nxt_i}$。
 
 > **证明** 令$x$为最小循环节的长度,只要证明不存在$y$满足$y \lt x$且$S_{1, i-y}=S_{y+1, i}$。
 >
-> 假设存在这样的$y$,那么$S_{y+1, y+x}=S_{1, x}=S_{x+1, 2x}$。令$A=S_{y+1, x}, \; B=S_{x+1, y+x}$,可以发现$A$是$S_{1, x}$的后缀、$S_{y+1, y+x}$的前缀,$B$是$S_{x+1, 2x}$的前缀、$S_{y+1, y+x}$的后缀,即$S_{1, x}=AB=BA$,根据**引理 2**,$S_{1, x}$是循环串,这与$x$是最小循环节的长度矛盾。因此这样的$y$不存在,而因为$S_{1, x}$是一个循环节,所以$S_{1, i-x}=S_{x+1, i}$,根据 KMP 的原理,$nxt_i=i-x$,即$S$的最小循环节是$S_{1, i-nxt_i}$。
+> 假设存在这样的$y$,那么$S_{y+1, y+x}=S_{1, x}=S_{x+1, 2x}$。令$A=S_{y+1, x}, \ B=S_{x+1, y+x}$,可以发现$A$是$S_{1, x}$的后缀、$S_{y+1, y+x}$的前缀,$B$是$S_{x+1, 2x}$的前缀、$S_{y+1, y+x}$的后缀,即$S_{1, x}=AB=BA$,根据**引理 2**,$S_{1, x}$是循环串,这与$x$是最小循环节的长度矛盾。因此这样的$y$不存在,而因为$S_{1, x}$是一个循环节,所以$S_{1, i-x}=S_{x+1, i}$,根据 KMP 的原理,$nxt_i=i-x$,即$S$的最小循环节是$S_{1, i-nxt_i}$。
 
 由此命题得证。

+ 1 - 1
source/_posts/oi/jackpot.md

@@ -14,7 +14,7 @@ date: 2017-06-08 01:30:55
 
 给定$n$个数$P_i$,求$\lim_{k \to \infty} {S_k \over 2k+1}$,其中$S_k$表示区间$[-k, k]$中能被至少一个$P_i$整除的数的个数。
 
-数据范围:$1 \le n \le 16, \; 1 \le P_i \le 10^9$。
+数据范围:$1 \le n \le 16, \ 1 \le P_i \le 10^9$。
 
 ## 算法分析
 

+ 2 - 2
source/_posts/oi/jumping-joe.md

@@ -27,13 +27,13 @@ P_1+N_1+P_2+N_2&=K
 \right.
 $$
 
-数据范围:$0 \lt x_1, x_2 \lt 40000, \; -40000 \lt P \lt 40000, \; 0 \le K \lt 2 \times 10^9$。
+数据范围:$0 \lt x_1, x_2 \lt 40000, \ -40000 \lt P \lt 40000, \ 0 \le K \lt 2 \times 10^9$。
 
 ## 算法分析
 
 设$g=(x_1, x_2)$,如果$g \not \mid P$则无解,否则可以将$x_1, x_2, P$同时除以$g$,对答案没有影响。
 
-设$a=P_1-N_1, \; b=P_2-N_2$,则$ax_1+bx_2=P$,可用扩展 GCD 求出它的一组解。若$(a, b)$是一组解,则$(a+kx_2, b-kx_1)$也是一组解。只要在$\pm P$的范围内枚举$k$,判断是否存在$(P_1, N_1, P_2, N_2)$满足第二个方程即可。
+设$a=P_1-N_1, \ b=P_2-N_2$,则$ax_1+bx_2=P$,可用扩展 GCD 求出它的一组解。若$(a, b)$是一组解,则$(a+kx_2, b-kx_1)$也是一组解。只要在$\pm P$的范围内枚举$k$,判断是否存在$(P_1, N_1, P_2, N_2)$满足第二个方程即可。
 
 ## 代码
 

+ 1 - 1
source/_posts/oi/karen-and-cards.md

@@ -29,7 +29,7 @@ She now wonders how many different cards can beat all the cards in her collectio
 
 给定$n$张牌,每张牌有三个属性$a_i, b_i, c_i$。一张牌能压制另一张牌$\Leftrightarrow$前者的至少两个属性严格大于后者的对应属性。已知三个属性的上限分别为$p, q, r$,问有多少种不同的牌能压制给定的$n$张牌。
 
-数据范围:$1 \le n, p, q, r \le 5 \times 10^5, \; 1 \le a_i \le p, \; 1 \le b_i \le q, \; 1 \le c_i \le r$。
+数据范围:$1 \le n, p, q, r \le 5 \times 10^5, \ 1 \le a_i \le p, \ 1 \le b_i \le q, \ 1 \le c_i \le r$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/karen-and-game.md

@@ -26,7 +26,7 @@ Karen is stuck on one level, and wants to know a way to beat this level using th
 
 给定一个初始全为$0$的矩阵$s$和一个目标矩阵$g$,两矩阵大小均为$n \times m$。每次操作可以将矩阵$s$中某一行或某一列的数全部加一。求一个能将$s$变成$g$且操作数最少的操作序列。
 
-数据范围:$1 \le n, m \le 100, \; 0 \le g_{i, j} \le 500$。
+数据范围:$1 \le n, m \le 100, \ 0 \le g_{i, j} \le 500$。
 
 ## 算法分析
 

+ 3 - 3
source/_posts/oi/karen-and-supermarket.md

@@ -28,7 +28,7 @@ Karen wants to know the following. What is the maximum number of goods she can b
 
 有$n$件商品,第$i$件商品的价格为$c_i$。同时,第$i$件商品有一张可以将价格降低$d_i$的优惠券,使用这张优惠券的前提是第$x_i$件商品的优惠券也被使用(使用优惠券后必须买对应的商品;第一件商品的优惠券没有使用前提)。问在总价格不超过$b$的情况下最多能购买多少商品。
 
-数据范围:$1 \le n \le 5000, \; 1 \le b \le 10^9, \; 1 \le d_i \lt c_i \le 10^9, \; 1 \le x_i \lt i$。
+数据范围:$1 \le n \le 5000, \ 1 \le b \le 10^9, \ 1 \le d_i \lt c_i \le 10^9, \ 1 \le x_i \lt i$。
 
 ## 算法分析
 
@@ -37,7 +37,7 @@ Karen wants to know the following. What is the maximum number of goods she can b
 令$s_i$表示第$i$件商品已处理过的子树大小,$f_{i, j, 1/0}$表示从第$i$件商品以及它的子树中购买$j$件商品且第$i$件商品使用/不使用优惠券时的最少价格。初始时
 
 $$
-s_i=1, \; f_{i, 0, 0}=0, \; f_{i, 1, 0}=c_i, \; f_{i, 1, 1}=c_i-d_i
+s_i=1, \ f_{i, 0, 0}=0, \ f_{i, 1, 0}=c_i, \ f_{i, 1, 1}=c_i-d_i
 $$
 
 转移方程如下
@@ -49,7 +49,7 @@ f_{i, j + k, 1}&=\min(f_{i, j, 1} + \min(f_{u, k, 0}, f_{u, k, 1}))
 \end{align}
 $$
 
-转移时需要满足$u$是$i$的儿子,且$0 \le j \le s_i, \; 0 \le k \le s_u$。
+转移时需要满足$u$是$i$的儿子,且$0 \le j \le s_i, \ 0 \le k \le s_u$。
 
 ## 代码
 

+ 14 - 14
source/_posts/oi/karen-and-test.md

@@ -30,7 +30,7 @@ Since this number can be quite large, output only the non-negative remainder aft
 
 有$n$个正整数$a_i$写在一行。依次对相邻两个数交错进行加减运算,并把结果写在下一行,重复这一过程直到只剩下一个数。第一次进行的是加法运算,求最后得到的数。
 
-数据范围:$1 \le n \le 2 \times 10^5, \; 1 \le a_i \le 10^9$。
+数据范围:$1 \le n \le 2 \times 10^5, \ 1 \le a_i \le 10^9$。
 
 ## 算法分析
 
@@ -38,22 +38,22 @@ Since this number can be quite large, output only the non-negative remainder aft
 
 $$
 \begin{align}
-n=1,\;&ans=a_1 \\\\
-n=2,\;&ans=a_1+a_2 \\\\
-n=3,\;&ans=a_1+2a_2-a_3 \\\\
-n=4,\;&ans=a_1-a_2+a_3-a_4 \\\\
-n=5,\;&ans=a_1+2a_3+a_5 \\\\
-n=6,\;&ans=a_1+a_2+2a_3+2a_4+a_5+a_6 \\\\
-n=7,\;&ans=a_1+2a_2+a_3+4a_4-a_5+2a_6-a_7 \\\\
-n=8,\;&ans=a_1-a_2+3a_3-3a_4+3a_5-3a_6+a_7-a_8 \\\\
-n=9,\;&ans=a_1+4a_3+6a_5+4a_7+a_9 \\\\
-n=10,\;&ans=a_1+a_2+4a_3+4a_4+6a_5+6a_6+4a_7+4a_8+a_9+a_{10} \\\\
-n=11,\;&ans=a_1+2a_2+3a_3+8a_4+2a_5+12a_6-2a_7+8a_8-3a_9+2a_{10}-a_{11} \\\\
-n=12,\;&ans=a_1-a_2+5a_3-5a_4+10a_5-10a_6+10a_7-10a_8+5a_9-5a_{10}+a_{11}-a_{12}
+n=1, \ & ans=a_1 \\\\
+n=2, \ & ans=a_1+a_2 \\\\
+n=3, \ & ans=a_1+2a_2-a_3 \\\\
+n=4, \ & ans=a_1-a_2+a_3-a_4 \\\\
+n=5, \ & ans=a_1+2a_3+a_5 \\\\
+n=6, \ & ans=a_1+a_2+2a_3+2a_4+a_5+a_6 \\\\
+n=7, \ & ans=a_1+2a_2+a_3+4a_4-a_5+2a_6-a_7 \\\\
+n=8, \ & ans=a_1-a_2+3a_3-3a_4+3a_5-3a_6+a_7-a_8 \\\\
+n=9, \ & ans=a_1+4a_3+6a_5+4a_7+a_9 \\\\
+n=10, \ & ans=a_1+a_2+4a_3+4a_4+6a_5+6a_6+4a_7+4a_8+a_9+a_{10} \\\\
+n=11, \ & ans=a_1+2a_2+3a_3+8a_4+2a_5+12a_6-2a_7+8a_8-3a_9+2a_{10}-a_{11} \\\\
+n=12, \ & ans=a_1-a_2+5a_3-5a_4+10a_5-10a_6+10a_7-10a_8+5a_9-5a_{10}+a_{11}-a_{12}
 \end{align}
 $$
 
-可以发现,对于模$4$余$1$的$n$,其答案中第$i \; (i \bmod 2=1)$项的系数为${2n/4 \choose i/2}$;对于模$4$余$2$的$n$也有类似的结论。而对于模$4$余$0$或余$3$的$n$,都可以由$(n-2)$的答案推导出来。
+可以发现,对于模$4$余$1$的$n$,其答案中第$i \ (i \bmod 2=1)$项的系数为${2n/4 \choose i/2}$;对于模$4$余$2$的$n$也有类似的结论。而对于模$4$余$0$或余$3$的$n$,都可以由$(n-2)$的答案推导出来。
 
 接下来就是计算组合数的问题。易知${n \choose 0}=1, {n \choose i} \times {n-i \over i+1}={n \choose i+1}$。由于涉及到模意义下的除法,因此还需要计算逆元。
 

+ 2 - 2
source/_posts/oi/kyoya-and-train.md

@@ -21,9 +21,9 @@ Kyoya wants to get to school by spending the least amount of money in expectatio
 
 ## 题意概述
 
-有$n$座城市和$m$条铁路,第$i$条铁路从$a_i$号城市出发,到达$b_i$号城市,票价为$c_i$。某人要在$t$个单位时间内从$1$号城市到$n$号城市,如果超过时间就会被罚款$x$。已知每次搭乘第$i$条铁路有$p_{i, k}$的概率需要$k \; (1 \le k \le t)$个单位时间。求在采取最优策略的情况下总花费的期望。
+有$n$座城市和$m$条铁路,第$i$条铁路从$a_i$号城市出发,到达$b_i$号城市,票价为$c_i$。某人要在$t$个单位时间内从$1$号城市到$n$号城市,如果超过时间就会被罚款$x$。已知每次搭乘第$i$条铁路有$p_{i, k}$的概率需要$k \ (1 \le k \le t)$个单位时间。求在采取最优策略的情况下总花费的期望。
 
-数据范围:$2 \le n \le 50, \; 1 \le m \le 100, \; 1 \le t \le 20000, \; 0 \le x \le 10^6$。
+数据范围:$2 \le n \le 50, \ 1 \le m \le 100, \ 1 \le t \le 20000, \ 0 \le x \le 10^6$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/legacy.md

@@ -30,7 +30,7 @@ Rick doesn't known where Morty is, but Unity is going to inform him and he wants
 
 有$n$个点以及$q$条边。边有$3$种类型:① 从点$v$到点$u$;② 从点$v$到编号在$[l, r]$之间的点;③ 从编号在$[l, r]$之间的点到点$v$。每条边都有一个权值$w$。求从点$s$出发到其他所有点的最短路径长度。
 
-数据范围:$1 \le n, q \le 10^5, \; 1 \le w \le 10^9$。
+数据范围:$1 \le n, q \le 10^5, \ 1 \le w \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/little-pony-and-elements-of-harmony.md

@@ -27,7 +27,7 @@ Given the transformation coefficient and the energy distribution at time $0$ ($e
 
 给定$m$。令$n=2^m$,$f(x, y)$表示$x \oplus y$(异或)在二进制下$1$的个数。给定一个长为$n$的数组$e_0$和一个长为$(m+1)$的数组$b$。有递推关系$e_i[u]=\sum_v e_{i-1}[v] \cdot b[f(u, v)]$。求$e_t$在模$p$意义下的值。
 
-数据范围:$1 \le m \le 20, \; 0 \le t \le 10^{18}, \; 2 \le p \le 10^9, \; 1 \le e_0[i] \le 10^9, \; 0 \le b[i] \le 10^9$。
+数据范围:$1 \le m \le 20, \ 0 \le t \le 10^{18}, \ 2 \le p \le 10^9, \ 1 \le e_0[i] \le 10^9, \ 0 \le b[i] \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/little-pony-and-lord-tirek.md

@@ -28,7 +28,7 @@ Lord Tirek will do $m$ instructions, each of them can be described with three in
 
 有$n$匹马,第$i$匹马初始时有$s_i$点魔法,魔法上限为$m_i$,每秒增加$r_i$点魔法。有$m$次操作,第$i$次操作在第$t_i$秒进行,将区间$[l_i, r_i]$中马的魔法清零。求每次操作清除了多少点魔法。
 
-数据范围:$1 \le n, m \le 10^5, \; 0 \le s_i \le m_i \le 10^5, \; 0 \le r_i \le 10^5, \; 0 \le t_i \le 10^9$。
+数据范围:$1 \le n, m \le 10^5, \ 0 \le s_i \le m_i \le 10^5, \ 0 \le r_i \le 10^5, \ 0 \le t_i \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/matching-names.md

@@ -22,7 +22,7 @@ Find the matching between students and pseudonyms with the maximum _quality_.
 
 给定$2n$个字符串$s_i$,前$n$个为一组,后$n$个为一组。要求将它们建立匹配(不能匹配同一组的字符串),使得两两匹配的字符串的$LCP$的长度之和最大。求最大值及方案。
 
-数据范围:$1 \le n \le 10^5, \; 1 \le \sum |s_i| \le 8 \times 10^5$。
+数据范围:$1 \le n \le 10^5, \ 1 \le \sum |s_i| \le 8 \times 10^5$。
 
 ## 算法分析
 

+ 4 - 4
source/_posts/oi/max-and-min.md

@@ -22,7 +22,7 @@ Max moves first. Kitten Min is winning if at some moment both numbers $a, b$ are
 
 有两个人 Max 和 Min,初始时有两个数$x$和$y$。Max 有$n$个数对$(a_i, b_i)$,Min 有$m$个数对$(c_j, d_j)$。两个人轮流操作,Max 先手。Max 可以选择一个数对$(a_i, b_i)$,将$x$加上$a_i$、$y$加上$b_i$;Min 可以选择一个数对$(c_j, d_j)$,将$x$减去$c_j$、$y$减去$d_j$。若在某一时刻$x, y$同时为负,则 Min 获胜,否则 Max 获胜。求谁必胜。
 
-数据范围:$1 \le n, m \le 10^5, \; 1 \le x, y, a_i, b_i, c_j, d_j \le 10^9$。
+数据范围:$1 \le n, m \le 10^5, \ 1 \le x, y, a_i, b_i, c_j, d_j \le 10^9$。
 
 ## 算法分析
 
@@ -32,8 +32,8 @@ Max moves first. Kitten Min is winning if at some moment both numbers $a, b$ are
 
 $$
 \begin{align}
-&\exists (a, b), \; a, b \ge 0 \land a+b \gt 0, \\\\
-&\exists (a_i, b_i), \; \forall (c_j, d_j), \; ((a_i, b_i), (a, b)) \ge ((c_j, d_j), (a, b))
+&\exists (a, b), \ a, b \ge 0 \land a+b \gt 0, \\\\
+&\exists (a_i, b_i), \ \forall (c_j, d_j), \ ((a_i, b_i), (a, b)) \ge ((c_j, d_j), (a, b))
 \end{align}
 $$
 
@@ -52,7 +52,7 @@ $$
 若$\exists (c_{j_0}, d_{j_0}), (c_{j_1}, d_{j_1})$,点$(a_i, b_i)$严格在点$(c_{j_0}, d_{j_0})$、$(c_{j_1}, d_{j_1})$和原点所组成的三角形内部,那么根据上述证明,$(a_i, b_i)$对 Max 没有贡献。特别的,若
 
 $$
-\exists (c_j, d_j), \; (a_i, b_i) \parallel (c_j, d_j) \land |(a_i, b_i)| \lt |(c_j, d_j)|
+\exists (c_j, d_j), \ (a_i, b_i) \parallel (c_j, d_j) \land |(a_i, b_i)| \lt |(c_j, d_j)|
 $$
 
 那么$(a_i, b_i)$也没有贡献。

+ 1 - 1
source/_posts/oi/meeting.md

@@ -20,7 +20,7 @@ Knowing that, in the end, both of them will show up at some time between $X$ o'c
 
 给定整数$X, Y$和实数$Z$,在$X$时到$Y$时之间任选两个时刻,求时刻之差不超过$Z$分钟的概率。
 
-数据范围:$0 \le X \lt Y \le 24, \; 0 \lt Z \le 60(Y-X)$。
+数据范围:$0 \le X \lt Y \le 24, \ 0 \lt Z \le 60(Y-X)$。
 
 ## 算法分析
 

+ 3 - 3
source/_posts/oi/memory-and-scores.md

@@ -19,13 +19,13 @@ Memory wonders how many possible games exist such that he ends with a strictly h
 
 ## 题意概述
 
-给定$a, b$和$k$,进行$t$次$a+=rand_{-k, k}, \; b+=rand_{-k, k}$,其中$rand_{i, j}$表示区间$[i, j]$中的随机整数。求最终$a \gt b$的方案数。
+给定$a, b$和$k$,进行$t$次$a+=rand_{-k, k}, \ b+=rand_{-k, k}$,其中$rand_{i, j}$表示区间$[i, j]$中的随机整数。求最终$a \gt b$的方案数。
 
-数据范围:$1 \le a, b \le 100, \; 1 \le k \le 1000, \; 1 \le t \le 100$。
+数据范围:$1 \le a, b \le 100, \ 1 \le k \le 1000, \ 1 \le t \le 100$。
 
 ## 算法分析
 
-令$f_{i, j}$表示第$i$轮两人分数相差$j$的方案数。显然,每一轮两人分数之差增加$t \; (|t| \le 2k)$的方案数为$2k+1-|t|$。
+令$f_{i, j}$表示第$i$轮两人分数相差$j$的方案数。显然,每一轮两人分数之差增加$t \ (|t| \le 2k)$的方案数为$2k+1-|t|$。
 
 容易写出 DP 方程
 

+ 1 - 1
source/_posts/oi/minimal-labels.md

@@ -26,7 +26,7 @@ Find such sequence of labels to satisfy all the conditions.
 
 给定一张$n$个点$m$条边的有向无环图。现要将图中所有点标号。如果点$u$有一条连向点$v$的边,那么点$u$的标号要比点$v$小。求一组字典序最小的标号方案。
 
-数据范围:$2 \le n \le 10^5, \; 1 \le m \le 10^5$。
+数据范围:$2 \le n \le 10^5, \ 1 \le m \le 10^5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/nearly-prime-numbers.md

@@ -18,7 +18,7 @@ Nearly prime number is an integer positive number for which it is possible to fi
 
 给定$N$个数$a_i$,分别判断它们是否仅由两个质数相乘得到。
 
-数据范围:$1 \le N \le 10, \; 1 \le a_i \le 10^9$。
+数据范围:$1 \le N \le 10, \ 1 \le a_i \le 10^9$。
 
 ## 算法分析
 

+ 3 - 3
source/_posts/oi/notes-on-math-theory.md

@@ -14,7 +14,7 @@ date: 2017-07-04 10:00:35
 
 ### Lucas
 
-$n=(a_ka_{k-1}a_{k-2}\ldots a_0)_p, \; m=(b_kb_{k-1}b_{k-2}\ldots b_0)_p, \; {n \choose m} \equiv \prod_{i=0}^k {a_i \choose b_i} \pmod p$.
+$n=(a_ka_{k-1}a_{k-2}\ldots a_0)_p, \ m=(b_kb_{k-1}b_{k-2}\ldots b_0)_p, \ {n \choose m} \equiv \prod_{i=0}^k {a_i \choose b_i} \pmod p$.
 
 $n!$中$p$的次数$=\sum_{i=1}^{\infty} [{n \over p^i}]={n-S_p(n) \over p-1}$
 
@@ -68,7 +68,7 @@ $n=1$成立。
 
 $n>1$时,设$p$为$n$最小的素因子。
 
-满足$p \mid 2^{d_0}-1$的最小的$d_0$,$\forall p \mid 2^n-1, \; d_0 \mid n$.
+满足$p \mid 2^{d_0}-1$的最小的$d_0$,$\forall p \mid 2^n-1, \ d_0 \mid n$.
 
 $\begin{cases} p \mid 2^n-1\\\\ p \mid 2^{p-1}-1\\\\ p \mid 2^d-1 \end{cases} \Rightarrow \begin{cases} d \mid n\\\\ d \mid p-1 \end{cases} \Rightarrow d=1 \Rightarrow p \mid 1 \Rightarrow n=1$.
 
@@ -122,7 +122,7 @@ $x^{p-1} \equiv 1 \pmod p$且$x^d \not \equiv 1 \pmod p, d \lt p-1$,$x$是原
 
 $x^{q^{\alpha}} \equiv 1 \pmod p$.
 
-$x^{q^{\alpha-1}} \not \equiv 1 \Leftrightarrow \forall d \lt q^{alpha}, \; x^d \not \equiv 1 \pmod p$.
+$x^{q^{\alpha-1}} \not \equiv 1 \Leftrightarrow \forall d \lt q^{alpha}, \ x^d \not \equiv 1 \pmod p$.
 
 $x^{(q^{\alpha}, d)} \equiv 1 \Leftrightarrow x^{q^{\beta}} \equiv 1 \pmod p$.
 

+ 5 - 5
source/_posts/oi/notes-on-module.md

@@ -35,7 +35,7 @@ $$
 因此原方程的解为
 
 $$
-x \equiv (a/(a, m))^{-1} \times (b/(a, m)) + (m/(a, m)) \times k \pmod m \; (0 \le k \lt (a, m))
+x \equiv (a/(a, m))^{-1} \times (b/(a, m)) + (m/(a, m)) \times k \pmod m \ (0 \le k \lt (a, m))
 $$
 
 原方程可能有多解,也可能无解。
@@ -101,7 +101,7 @@ $$
 如果同余方程组满足
 
 $$
-\forall i \in [1, n], \; a_i=1 \land \forall i, j \in [1, n] \land i \neq j, \; (m_i, m_j)=1
+\forall i \in [1, n], \ a_i=1 \land \forall i, j \in [1, n] \land i \neq j, \ (m_i, m_j)=1
 $$
 
 那么答案的形式一定是
@@ -131,7 +131,7 @@ $$
 
 在计数问题中经常用到$n!$。因此有必要了解$n!$在模$p$意义下的一些性质。
 
-假设$p$是素数,$n!=ap^e \; (a \not \mid p)$,求$a \bmod p$和$e$,$e$是$n!$能够迭代整除$p$的次数。显然
+假设$p$是素数,$n!=ap^e \ (a \not \mid p)$,求$a \bmod p$和$e$,$e$是$n!$能够迭代整除$p$的次数。显然
 
 $$
 e=n/p+n/p^2+n/p^3+ \cdots
@@ -156,7 +156,7 @@ $$
 当$p$不太大时,根据卢卡斯定理,令
 
 $$
-n=\sum n_ip^i \; (0 \le n_i \lt p), \; k=\sum k_ip^i \; (0 \le k_i \lt p)
+n=\sum n_ip^i \ (0 \le n_i \lt p), \ k=\sum k_ip^i \ (0 \le k_i \lt p)
 $$
 
@@ -174,7 +174,7 @@ $$
 
 $$
-n!=a_1p^{e_1}, \; k!=a_2p^{e_2}, \; (n-k)!=a_3p^{e_3}
+n!=a_1p^{e_1}, \ k!=a_2p^{e_2}, \ (n-k)!=a_3p^{e_3}
 $$
 
 从中可以看出,当$e_1 \gt e_2+e_3$时,${n \choose k}$可以被$p$整除;当$e_1=e_2+e_3$时,${n \choose k}$无法被$p$整除,此时${n \choose k} \equiv a_1(a_2a_3)^{-1} \pmod p$。

+ 5 - 5
source/_posts/oi/notes-on-multiplicative-inverse.md

@@ -16,7 +16,7 @@ date: 2017-07-01 18:20:58
 当$(a, b)=1$时,有
 
 $$
-\exists x, y \in Z, \; ax+by=1
+\exists x, y \in Z, \ ax+by=1
 $$
 
 扩展欧几里得算法证明如下:
@@ -29,7 +29,7 @@ $$
 > a \times 1+b \times 0=a=(a, b)=1
 > $$
 >
-> 此时$x=1, \; y=0$。
+> 此时$x=1, \ y=0$。
 >
 > 当$b \neq 0$时,有
 >
@@ -54,7 +54,7 @@ $$
 > a \times x_1+b \times y_1=b \times x_2+a \times y_2-a/b \times b \times y_2
 > $$
 >
-> 那么$x_1=y_2, \; y_1=x_2-a/b \times y_2$。
+> 那么$x_1=y_2, \ y_1=x_2-a/b \times y_2$。
 
 由此得证。
 
@@ -84,7 +84,7 @@ $$
 > 根据费马小定理,当$p$是质数时,有
 >
 > $$
-> \forall x \in Z, \; x^p \equiv x \pmod p
+> \forall x \in Z, \ x^p \equiv x \pmod p
 > $$
 >
 > 当$p \nmid x$时,有
@@ -110,7 +110,7 @@ $$
 
 证明如下:
 
-> 令$t=p/i, \; k=p \bmod i$。易知
+> 令$t=p/i, \ k=p \bmod i$。易知
 >
 > $$
 > \begin{align}

+ 1 - 1
source/_posts/oi/office-keys.md

@@ -20,7 +20,7 @@ You are to determine the minimum time needed for all $n$ people to get to the of
 
 在一条数轴上有$n$个人和$k$把钥匙。每个人一秒可以移动一个单位长度。已知办公室的位置在$p$,求所有人都拿到一把钥匙并到达办公室的最少时间。
 
-数据范围:$1 \le n \le 1000, \; 1 \le k \le 2000, \; 1 \le p \le 10^9$。
+数据范围:$1 \le n \le 1000, \ 1 \le k \le 2000, \ 1 \le p \le 10^9$。
 
 ## 算法分析 1
 

+ 1 - 1
source/_posts/oi/open-the-brackets.md

@@ -36,7 +36,7 @@ Make the expression, which will be identical with given expression. New expressi
 
 将一个逻辑表达式$s$转化成一个不包含括号的等价表达式$t$。保证$s$中变量的个数不超过$10$。
 
-数据范围:$1 \le |s| \le 2048, \; 1 \le |t| \le 32768$。
+数据范围:$1 \le |s| \le 2048, \ 1 \le |t| \le 32768$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/opening-portals.md

@@ -23,7 +23,7 @@ At the beginning of the game Pavel is in city number $1$. He wants to open all p
 
 给定一张$n$个点$m$条边的无向图,其中$k$个点上有传送器,每条边都有一个权值。初始时所有传送器都处于关闭状态,你在$1$号点。你需要走到所有有传送器的点,将传送器打开。你可以从一个已经打开的传送器直接传送到另一个已经打开的传送器。求经过的所有边的权值和的最小值。
 
-数据范围:$1 \le k \le n \le 10^5, \; 0 \le m \le 10^5$。
+数据范围:$1 \le k \le n \le 10^5, \ 0 \le m \le 10^5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/paths-in-a-complete-binary-tree.md

@@ -29,7 +29,7 @@ For example, if $u_i=4$ and $s_i=UURL$, then the answer is $10$.
 
 给定一棵有$n$个节点的按中序遍历编号的完全二叉树、起始点的编号$u$以及只由$L, R$和$U$组成的操作序列$s$(其中$L$表示走到左儿子,$R$表示走到右儿子,$U$表示走到父亲),求终止点的编号。
 
-数据范围:$1 \le n \le 10^{18}, \; 1 \le u_i \le n, \; 1 \le |s_i| \le 10^5$。
+数据范围:$1 \le n \le 10^{18}, \ 1 \le u_i \le n, \ 1 \le |s_i| \le 10^5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/perishable-roads.md

@@ -37,7 +37,7 @@ The government of Never has not yet decided where to build the museum, so they c
 
 考虑经我们修改过的图,如果一条路径经过了$0$边(边权为$0$的边),那么它对答案没有贡献。由于一定存在一条链的最优解,且图是完全图,因此只要考虑从每个点出发到与$0$边相邻的点的距离之和的最小值。
 
-假设我们走过的路径中,第$i$个点和第$(i+1)$个点之间的边的权值为$a_i$。令$k$满足$a_{1..k-1} \gt 0 \land a_k=0$,那么$\forall i \le k-3, \; a_i \gt a_{i+1}$。否则,第$(i+1)$个点和第$(i+2)$个点之间的边产生的贡献为$a_i$,与第$(i+2)$个点是什么无关,那么我们可以直接将第$(i+1)$个点连到一个与$0$边相邻的点上,使$k$变小,答案更优。
+假设我们走过的路径中,第$i$个点和第$(i+1)$个点之间的边的权值为$a_i$。令$k$满足$a_{1..k-1} \gt 0 \land a_k=0$,那么$\forall i \le k-3, \ a_i \gt a_{i+1}$。否则,第$(i+1)$个点和第$(i+2)$个点之间的边产生的贡献为$a_i$,与第$(i+2)$个点是什么无关,那么我们可以直接将第$(i+1)$个点连到一个与$0$边相邻的点上,使$k$变小,答案更优。
 
 这样一来,对于前$(k-3)$个点来说,它们产生的贡献就是$\sum_{i=1}^{k-3} a_i$,只要考虑$a_{k-1}$和$a_{k-2}$的关系。若$a_{k-1} \lt a_{k-2}$,那么贡献的计算方法与前面的点一样;否则,贡献为$2a_{k-2}$。
 

+ 1 - 1
source/_posts/oi/petya-and-tree.md

@@ -27,7 +27,7 @@ It is known for sure that during the search we make a mistake in comparing exact
 
 给定一棵包含$n$个节点的二叉搜索树,每个节点都有$0$个或$2$个儿子。如果一个节点有儿子,那么它左子树中的所有节点的值都严格小于这个节点,它右子树中的所有节点的值都严格大于这个节点。由于一些差错,这棵搜索树在查找一个值时总是会犯恰好一次错误——应该往左查找时却往右查找,应该往右查找时却往左查找。现有$k$个树中不存在的值待查找,求每一次查找得到的数的期望。
 
-数据范围:$3 \le n \lt 10^5, \; 1 \le k \le 10^5$。
+数据范围:$3 \le n \lt 10^5, \ 1 \le k \le 10^5$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/picnic-cows.md

@@ -17,7 +17,7 @@ It's summer vocation now. After tedious milking, cows are tired and wish to take
 
 Farmer Carolina takes her $N$ cows to the destination, but she finds every cow's degree of interest in this activity is so different that they all loss their interests. So she has to group them to different teams to make sure that every cow can go to a satisfied team. Considering about the security, she demands that there must be no less than $T$ cows in every team. As every cow has its own interest degree of this picnic, we measure this interest degree's unit as "_Moo~_". Cows in the same team should reduce their _Moo~_ to the one who has the lowest _Moo~_ in this team - It's not a democratical action! So Carolina wishes to minimize the **TOTAL** reduced _Moo~_ s and groups $N$ cows into several teams.
 
-For example, Carolina has $7$ cows to picnic and their _Moo~_ are '$8 \; 5 \; 6 \; 2 \; 1 \; 7 \; 6$' and at least $3$ cows in every team. So the best solution is that cow No. $2, 4, 5$ in a team (reduce $((2-1)+(5-1))$ _Moo~_) and cow No. $1, 3, 6, 7$ in a team (reduce $((7-6)+(8-6))$ _Moo~_), the answer is $8$.
+For example, Carolina has $7$ cows to picnic and their _Moo~_ are '$8 \ 5 \ 6 \ 2 \ 1 \ 7 \ 6$' and at least $3$ cows in every team. So the best solution is that cow No. $2, 4, 5$ in a team (reduce $((2-1)+(5-1))$ _Moo~_) and cow No. $1, 3, 6, 7$ in a team (reduce $((7-6)+(8-6))$ _Moo~_), the answer is $8$.
 
 ## 题意概述
 

+ 1 - 1
source/_posts/oi/pishty-and-tree.md

@@ -33,7 +33,7 @@ Given $M$ groups of tourists, find the total attractivity of the path for each g
 
 给定一棵有$N$个节点的树,每条边都有一个权值$C$。有$M$组询问,每组询问给定$U, V$和$K$,求$U$到$V$路径上权值不超过$K$的边的权值的异或和。
 
-数据范围:$1 \le N, M \le 10^5, \; 1 \le C, K \le 10^9$。
+数据范围:$1 \le N, M \le 10^5, \ 1 \le C, K \le 10^9$。
 
 ## 算法分析 1
 

+ 2 - 2
source/_posts/oi/primes.md

@@ -14,7 +14,7 @@ date: 2019-08-28 10:35:56
 
 This is an interactive problem.
 
-For two positive integers $x, y$, we define $\pi(x, y)$ to be the number of distinct primes that divide both $x$ and $y$. For example $\pi(2, 3) = 0, \; \pi(8, 16) = 1$ and $\pi(30, 105) = 2$.
+For two positive integers $x, y$, we define $\pi(x, y)$ to be the number of distinct primes that divide both $x$ and $y$. For example $\pi(2, 3) = 0, \ \pi(8, 16) = 1$ and $\pi(30, 105) = 2$.
 
 For two positive integers $a, b$, where $a \le b$, we define $S(a, b)$ to be the sum of values $\pi(x, y)$ over all pairs of integers $(x, y)$ satisfying $a \le x \lt y \le b$.
 
@@ -24,7 +24,7 @@ Your task is to compute the values $S(a, b)$ for many query pairs $(a, b)$. To m
 
 给定两个整数$a, b$,定义$\pi(x, y)$为所有整除$x$和$y$的质数的个数,$S(a, b)$为所有满足$a \le x \lt y \le b$的$\pi(x, y)$的和,求$S(a, b)$。有$q$组询问,强制在线。
 
-数据范围:$1 \le q \le 50000, \; 1 \le a \le b \le 10^6$。
+数据范围:$1 \le q \le 50000, \ 1 \le a \le b \le 10^6$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/print-article.md

@@ -28,7 +28,7 @@ Now Zero want to know the minimum cost in order to arrange the article perfectly
 
 一篇文章中有$N$个单词,输入第$i$个单词的代价为$C_i$。将连续$k$个单词排在一行的总代价为$\left(\sum_{i=1}^k C_i\right)^2+M$。求输入这篇文章的最小代价。
 
-数据范围:$0 \le N \le 5 \times 10^5, \; 0 \le M \le 1000$。
+数据范围:$0 \le N \le 5 \times 10^5, \ 0 \le M \le 1000$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/query-on-the-subtree.md

@@ -29,7 +29,7 @@ Note that the distance between vertex $u$ and $v$ is the number of edges on the
 
 给定一棵有$n$个节点的树,第$i$个节点的权值为$w_i$。有两种操作:① 将节点$v$的权值变成$x$;② 询问与节点$v$的距离不超过$d$的所有节点的权值和。共有$q$次操作。
 
-数据范围:$1 \le n, q \le 10^5, \; 0 \le w_i \le 10^4, \; 0 \le x \le 10^4, \; 0 \le d \le n$。
+数据范围:$1 \le n, q \le 10^5, \ 0 \le w_i \le 10^4, \ 0 \le x \le 10^4, \ 0 \le d \le n$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/recover-path.md

@@ -22,7 +22,7 @@ It is guaranteed that there exists some shortest path going through all specifie
 
 给定一张$n$个点$m$条边的无向图,第$i$条边的权值为$t_i$。给定其中$k$个点,要求找一对点$s, t$,使得这$k$个点都在从$s$到$t$的某条最短路径上,并输出这条路径。保证有解。
 
-数据范围:$1 \le n, m \le 10^5, \; 1 \le t_i \le 10000$。
+数据范围:$1 \le n, m \le 10^5, \ 1 \le t_i \le 10000$。
 
 ## 算法分析
 

+ 2 - 2
source/_posts/oi/recruiting.md

@@ -25,7 +25,7 @@ Note that both companies have the full information during the hiring: friendship
 
 给定一张$n$个点$m$条边的无向图。两个人轮流选点。每个人的第一个点可以任意选,接下来每次都必须从与自己已选的点相邻的点中选一个。不能选已被选的点。若某一轮中某人不存在满足条件的点,则他这一轮不选。已知$1$、$2$、$3$号点是重要点,两人都想尽可能多地选到重要点。问在最优策略下,谁能选到更多的重要点。保证不会平局。
 
-数据范围:$3 \le n \le 10^5, \; 2 \le m \le 2 \times 10^5$。
+数据范围:$3 \le n \le 10^5, \ 2 \le m \le 2 \times 10^5$。
 
 ## 算法分析
 
@@ -34,7 +34,7 @@ Note that both companies have the full information during the hiring: friendship
 令$d_{i, j}$表示$i$号点和$j$号点之间最短路径的长度。那么先手必胜当且仅当
 
 $$
-\exists i, \; \forall j, \; \sum_{k=1}^3 [d_{k, i} \gt d_{k, j}] \lt 2
+\exists i, \ \forall j, \ \sum_{k=1}^3 [d_{k, i} \gt d_{k, j}] \lt 2
 $$
 
 考虑它的意义。对于$i$号点,若存在一个$j$号点使得$i$号点到某两个重要点的距离严格大于$j$号点到这两个点的距离,则先手不能选$i$号点;否则,先手选$i$号点必胜。证明略。

+ 1 - 1
source/_posts/oi/rectangle.md

@@ -23,7 +23,7 @@ You are given four integers: $H, W, h$ and $w$. Determine whether there exists a
 
 构造一个$H \times W$的矩阵,使得这个矩阵中所有数字的和为正数,而其任意一个$h \times w$的子矩阵中所有数字的和为负数。
 
-数据范围:$1 \le h \le H \le 500, \; 1 \le w \le W \le 500$。
+数据范围:$1 \le h \le H \le 500, \ 1 \le w \le W \le 500$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/repairing-company.md

@@ -19,7 +19,7 @@ Lily runs a repairing company that services the $Q$ blocks in the city. One day
 
 有$Q$个街道和$M$个任务。给出两两街道之间的距离以及每个任务的地点$p_i$、开始时间$t_i$和花费时间$d_i$。问至少需要多少个工人才能完成所有任务。工人开始时可以在任意街道,一个工人只能同时做一个任务。
 
-数据范围:$1 \le Q \le 20, \; 1 \le M \le 200$。
+数据范围:$1 \le Q \le 20, \ 1 \le M \le 200$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/sereja-and-subsequences.md

@@ -24,7 +24,7 @@ Now Sereja wonders, how many sequences are written on the lines piece of paper.
 
 定义一个序列$a_1, a_2, \ldots, a_k$的数量等于长度为$k$且第$i$个元素不大于$a_i$的序列的个数。给定一个长度为$n$的序列,求其所有不下降子序列的数量之和。
 
-数据范围:$1 \le n \le 10^5, \; 1 \le a_i \le 10^6$。
+数据范围:$1 \le n \le 10^5, \ 1 \le a_i \le 10^6$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/shaass-and-bookshelf.md

@@ -26,7 +26,7 @@ Help Shaass to find the minimum total thickness of the vertical books that we ca
 
 给定$n$个$t_i, w_i$,要求将它们分成两组,使得第一组中$t_i$之和不小于第二组中$w_i$之和。求第一组中$t_i$之和的最小值。
 
-数据范围:$1 \le n \le 100, \; 1 \le t_i \le 2, \; 1 \le w_i \le 100$。
+数据范围:$1 \le n \le 100, \ 1 \le t_i \le 2, \ 1 \le w_i \le 100$。
 
 ## 算法分析 1
 

+ 3 - 3
source/_posts/oi/shaass-and-lights.md

@@ -23,7 +23,7 @@ He knows the initial state of lights and he's wondering how many different ways
 
 ## 算法分析
 
-显然,开着的灯把关着的灯分成了若干个区间。设有$k$个区间,第$i$个区间的长度为$l_i \; (0 \le l_i \le n)$,将这个区间内的灯全部打开的方案数为$s_i$。对于$s_i$满足
+显然,开着的灯把关着的灯分成了若干个区间。设有$k$个区间,第$i$个区间的长度为$l_i \ (0 \le l_i \le n)$,将这个区间内的灯全部打开的方案数为$s_i$。对于$s_i$满足
 
 $$
 s_i=
@@ -37,12 +37,12 @@ $$
 
 > 对于第$1, k$个区间,只能从区间的一端开始开灯,只有一种方案。
 >
-> 对于第$i \; (1 \lt i \lt k)$个区间,总共要开$l_i$次灯,除最后一次外,其他每一次开灯都可以选择从左端开还是从右端开,共有$2^{max(l_i-1, 0)}$种方案。
+> 对于第$i \ (1 \lt i \lt k)$个区间,总共要开$l_i$次灯,除最后一次外,其他每一次开灯都可以选择从左端开还是从右端开,共有$2^{max(l_i-1, 0)}$种方案。
 
 令$t_i=\sum_{j=1}^i l_j$,$f_i$表示打开前$i$个区间所有灯的方案数。对于$f_i$满足
 
 $$
-f_1=1, \; f_i={t_i \choose l_i}s_if_{i-1}
+f_1=1, \ f_i={t_i \choose l_i}s_if_{i-1}
 $$
 
 证明如下:

+ 2 - 2
source/_posts/oi/shrinking.md

@@ -13,7 +13,7 @@ date: 2017-06-21 18:20:36
 
 Snuke can change a string $t$ of length $N$ into a string $t'$ of length $N-1$ under the following rule:
 
-- for each $i \; (1 \le i \le N-1)$, the $i$-th character of $t'$ must be either the $i$-th or $(i+1)$-th character of $t$.
+- for each $i \ (1 \le i \le N-1)$, the $i$-th character of $t'$ must be either the $i$-th or $(i+1)$-th character of $t$.
 
 There is a string $s$ consisting of lowercase English letters. Snuke's objective is to apply the above operation to $s$ repeatedly so that all the characters in $s$ are the same. Find the minimum necessary number of operations.
 
@@ -22,7 +22,7 @@ There is a string $s$ consisting of lowercase English letters. Snuke's objective
 给定一个初始长度为$len$的字符串$s$。每次操作可以将$s$变成长度为$(len-1)$的字符串$s'$,并且满足
 
 $$
-\forall i \in [1, len-1], \; s_i'=s_i \lor s_i'=s_{i+1}
+\forall i \in [1, len-1], \ s_i'=s_i \lor s_i'=s_{i+1}
 $$
 
 问至少经过多少次操作使得$s$中所有字母都相同。

+ 3 - 3
source/_posts/oi/similarity-of-necklaces-2.md

@@ -15,16 +15,16 @@ date: 2018-01-16 18:25:42
 给定四个数组$M, P, L, R$,要求构造一个数组$T$,使得
 
 $$
-\sum_{i=1}^N M_iT_i=0 \; (L_i \le T_i \le R_i)
+\sum_{i=1}^N M_iT_i=0 \ (L_i \le T_i \le R_i)
 $$
 
 求$\sum_{i=1}^N P_iT_i$的最大值。
 
-数据范围:$1 \le N \le 200, \; 1 \le M_i \le 20, \; 0 \le P_i \le 10^5, \; -25 \le L_i \lt R_i \le 25$。
+数据范围:$1 \le N \le 200, \ 1 \le M_i \le 20, \ 0 \le P_i \le 10^5, \ -25 \le L_i \lt R_i \le 25$。
 
 ## 算法分析
 
-令$D_i=T_i-L_i$,那么限制条件变为$\sum_{i=1}^N M_iD_i=-\sum_{i=1}^N M_iL_i \; (0 \le D_i \le R_i-L_i)$,要求的值变为$\sum_{i=1}^N P_iD_i+\sum_{i=1}^N P_iL_i$。这就相当于有$N$种物品,第$i$种物品有$(R_i-L_i)$个,每一个的体积为$M_i$,价值为$P_i$,背包的体积为$-\sum_{i=1}^N M_iL_i$,求物品恰好装满背包时的最大价值。这是分组背包问题,用单调队列优化 DP 即可。
+令$D_i=T_i-L_i$,那么限制条件变为$\sum_{i=1}^N M_iD_i=-\sum_{i=1}^N M_iL_i \ (0 \le D_i \le R_i-L_i)$,要求的值变为$\sum_{i=1}^N P_iD_i+\sum_{i=1}^N P_iL_i$。这就相当于有$N$种物品,第$i$种物品有$(R_i-L_i)$个,每一个的体积为$M_i$,价值为$P_i$,背包的体积为$-\sum_{i=1}^N M_iL_i$,求物品恰好装满背包时的最大价值。这是分组背包问题,用单调队列优化 DP 即可。
 
 ## 代码
 

+ 1 - 1
source/_posts/oi/skills.md

@@ -25,7 +25,7 @@ Now Lesha has $m$ hacknetian currency units, which he is willing to spend. Each
 
 给定$n$个技能,第$i$个技能的等级为$a_i$。所有技能的最高等级为$A$。你有$m$个技能点,每个技能点可以让某个技能升$1$级。给定两个数$c_f, c_m$,定义所有技能的价值总和为$c_f$乘满级技能的个数加$c_m$乘所有技能的最低等级。求价值总和的最大值。
 
-数据范围:$1 \le n \le 10^5, \; 1 \le A \le 10^9, \; 0 \le c_f, c_m \le 1000, \; 0 \le m \le 10^{15}$。
+数据范围:$1 \le n \le 10^5, \ 1 \le A \le 10^9, \ 0 \le c_f, c_m \le 1000, \ 0 \le m \le 10^{15}$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/strange-radiation.md

@@ -23,7 +23,7 @@ You need to place the bomb is such a point that the minimum time moment in which
 
 在一条数轴上有$n$个人,第$i$个人的位置是$x_i$,速度是$v_i$。每个人初始时都面朝数轴正方向或负方向。现在你可以在数轴某一整点上放置一个炸弹。炸弹爆炸后,所有人都会向他当前面朝的方向奔跑。同时,炸弹会从放置点向数轴正负两侧分别发射出一道激光,速度是$s$。当一道激光碰到一个运动方向相同的人时,这个人的速度会立刻加上$s$。求放置炸弹后,至少有一个人到达$0$且至少有一个人到达$10^6$的最小时间。
 
-数据范围:$2 \le n \le 10^5, \; 0 \le x_i \le 10^6, \; 1 \le v_i \lt s \le 10^6$。
+数据范围:$2 \le n \le 10^5, \ 0 \le x_i \le 10^6, \ 1 \le v_i \lt s \le 10^6$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/string-reconstruction.md

@@ -21,7 +21,7 @@ You are to reconstruct lexicographically minimal string $s$ such that it fits al
 
 有一个未知的字符串$s$,只知道$n$个它的子串$t_i$以及它们在$s$中出现的次数$k_i$和位置$x_{i, j}$。要求构造出字典序最小的原串。
 
-数据范围:$1 \le n \le 10^5, \; 1 \le \sum |t_i|, \sum k_i, x_{i, j} \le 10^6$。
+数据范围:$1 \le n \le 10^5, \ 1 \le \sum |t_i|, \sum k_i, x_{i, j} \le 10^6$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/template-of-simplex-algorithm.md

@@ -15,7 +15,7 @@ date: 2018-02-23 17:00:14
 给定一个$n$维向量$a$、一个$m \times n$的矩阵$b$和一个$m$维向量$c$。要求构造一个$n$维向量$x$,使得在满足
 
 $$
-\forall i \in [1, m], \; \sum_{j=1}^n b_{i, j}x_j \le c_i
+\forall i \in [1, m], \ \sum_{j=1}^n b_{i, j}x_j \le c_i
 $$
 
 的前提下

+ 1 - 1
source/_posts/oi/the-child-and-binary-tree.md

@@ -20,7 +20,7 @@ Our child likes computer science very much, especially he likes binary trees.
 
 Consider the sequence of $n$ distinct positive integers: $c_1, c_2, \ldots, c_n$. The child calls a vertex-weighted rooted binary tree _good_ if and only if for every vertex $v$, the weight of $v$ is in the set ${c_1, c_2, \ldots, c_n}$. Also our child thinks that the _weight_ of a vertex-weighted tree is the sum of all vertices' weights.
 
-Given an integer $m$, can you for all $s \; (1 \le s \le m)$ calculate the number of good vertex-weighted rooted binary trees with weight $s$? Please, check the samples for better understanding what trees are considered different.
+Given an integer $m$, can you for all $s \ (1 \le s \le m)$ calculate the number of good vertex-weighted rooted binary trees with weight $s$? Please, check the samples for better understanding what trees are considered different.
 
 We only want to know the answer modulo $998244353$ ($7 \times 17 \times 2^{23}+1$, a prime number).
 

+ 2 - 2
source/_posts/oi/the-equation.md

@@ -13,7 +13,7 @@ date: 2017-10-12 20:20:02
 
 ## 题目描述
 
-There is an equation $ax+by+c=0$. Given $a,b,c,x_1,x_2,y_1,y_2$ you must determine, how many integer roots of this equation are satisfy to the following conditions: $x_1 \le x \le x_2, \; y_1 \le y \le y_2$. Integer root of this equation is a pair of integer numbers $(x,y)$.
+There is an equation $ax+by+c=0$. Given $a,b,c,x_1,x_2,y_1,y_2$ you must determine, how many integer roots of this equation are satisfy to the following conditions: $x_1 \le x \le x_2, \ y_1 \le y \le y_2$. Integer root of this equation is a pair of integer numbers $(x,y)$.
 
 ## 题意概述
 
@@ -25,7 +25,7 @@ There is an equation $ax+by+c=0$. Given $a,b,c,x_1,x_2,y_1,y_2$ you must determi
 
 先判断是否有解。若$a=b=0 \land c \neq 0 \lor (a, b) \nmid c$则无解。
 
-之后我们计算出$g=(a, b)$,令$a'={a \over g}, \; b'={b \over g}, \; c'={c \over g}$,方程变为$a'x+b'y=-c'$,用扩展 GCD 求出它的一组解$(x, y)$,那么该方程的通解为$(x+kb', y-ka')$。
+之后我们计算出$g=(a, b)$,令$a'={a \over g}, \ b'={b \over g}, \ c'={c \over g}$,方程变为$a'x+b'y=-c'$,用扩展 GCD 求出它的一组解$(x, y)$,那么该方程的通解为$(x+kb', y-ka')$。
 
 分别计算使$x, y$满足要求的$k$的范围,其交集的大小就是答案。在计算范围时可以二分查找。
 

+ 1 - 1
source/_posts/oi/the-lazy-programmer.md

@@ -22,7 +22,7 @@ The director has a difficult problem to solve. He needs to organize programmer's
 
 有$N$个合同,第$i$个合同需要在时刻$d_i$前完成。程序员完成第$i$个合同所需的时间为$b_i$,若给他$x_i$元钱则他完成这个合同所需的时间会减少$a_ix_i$(但不会小于$0$)。求在按时完成所有合同的前提下所需的最少钱数。
 
-数据范围:$1 \le N \le 10^5, \; 1 \le a_i, b_i \le 10^4, \; 1 \le d_i \le 10^9$。
+数据范围:$1 \le N \le 10^5, \ 1 \le a_i, b_i \le 10^4, \ 1 \le d_i \le 10^9$。
 
 ## 算法分析
 

+ 1 - 1
source/_posts/oi/the-sum-of-unitary-divisors.md

@@ -16,7 +16,7 @@ date: 2018-01-23 12:50:05
 
 A natural number $d$ is a unitary divisor of $n$ if $d$ is a divisor of $n$ and if $d$ and ${n \over d}$ are coprime.
 
-Let $\sigma^{\ast}(n)$ be the sum of the unitary divisors of $n$. For example, $\sigma^{\ast}(1)=1, \; \sigma^{\ast}(2)=3$ and $\sigma^{\ast}(6)=12$.
+Let $\sigma^{\ast}(n)$ be the sum of the unitary divisors of $n$. For example, $\sigma^{\ast}(1)=1, \ \sigma^{\ast}(2)=3$ and $\sigma^{\ast}(6)=12$.
 
 Let $S(n)=\sum_{i=1}^n \sigma^{\ast}(i)$.
 

+ 2 - 2
source/_posts/oi/tower.md

@@ -11,9 +11,9 @@ date: 2017-06-06 21:30:18
 
 ## 题意概述
 
-有一个数列,$a_1=1, \; a_n=2a_2a_{n-1}-a_{n-2}$。给定$a_2$,求这个数列前$N$项的平方和模$M$。有$T$组数据。
+有一个数列,$a_1=1, \ a_n=2a_2a_{n-1}-a_{n-2}$。给定$a_2$,求这个数列前$N$项的平方和模$M$。有$T$组数据。
 
-数据范围:$1 \le T \le 10^5, \; 1 \le a_2, M \le 10^9, \; 2 \le N \le 10^9$。
+数据范围:$1 \le T \le 10^5, \ 1 \le a_2, M \le 10^9, \ 2 \le N \le 10^9$。
 
 ## 算法分析
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini