Skip to content

Commit

Permalink
Site updated: 2023-10-27 21:35:53
Browse files Browse the repository at this point in the history
  • Loading branch information
YttriumWillow committed Oct 27, 2023
1 parent 7494e88 commit 3d273fd
Show file tree
Hide file tree
Showing 14 changed files with 277 additions and 84 deletions.
2 changes: 1 addition & 1 deletion 2023/10/26/Test-Article/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 2023/10/26/hello-world/index.html

Large diffs are not rendered by default.

116 changes: 116 additions & 0 deletions 2023/10/27/P5377-THUPC2019-鸽鸽的分割-题解/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions 2023/10/27/公式渲染压力测试/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion archives/2023/10/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion archives/2023/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion archives/index.html

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link href="https://yttriumwillow.github.io/atom.xml" rel="self"/>

<link href="https://yttriumwillow.github.io/"/>
<updated>2023-10-27T07:58:56.662Z</updated>
<updated>2023-10-27T13:35:45.454Z</updated>
<id>https://yttriumwillow.github.io/</id>

<author>
Expand All @@ -17,24 +17,25 @@
<generator uri="https://hexo.io/">Hexo</generator>

<entry>
<title>公式渲染压力测试</title>
<link href="https://yttriumwillow.github.io/2023/10/27/%E5%85%AC%E5%BC%8F%E6%B8%B2%E6%9F%93%E5%8E%8B%E5%8A%9B%E6%B5%8B%E8%AF%95/"/>
<id>https://yttriumwillow.github.io/2023/10/27/%E5%85%AC%E5%BC%8F%E6%B8%B2%E6%9F%93%E5%8E%8B%E5%8A%9B%E6%B5%8B%E8%AF%95/</id>
<published>2023-10-27T07:45:40.000Z</published>
<updated>2023-10-27T07:58:56.662Z</updated>
<title>P5377 [THUPC2019] 鸽鸽的分割 题解</title>
<link href="https://yttriumwillow.github.io/2023/10/27/P5377-THUPC2019-%E9%B8%BD%E9%B8%BD%E7%9A%84%E5%88%86%E5%89%B2-%E9%A2%98%E8%A7%A3/"/>
<id>https://yttriumwillow.github.io/2023/10/27/P5377-THUPC2019-%E9%B8%BD%E9%B8%BD%E7%9A%84%E5%88%86%E5%89%B2-%E9%A2%98%E8%A7%A3/</id>
<published>2023-10-27T13:06:27.000Z</published>
<updated>2023-10-27T13:35:45.454Z</updated>

<content type="html"><![CDATA[<h1 id="P8670-蓝桥杯-2018-国-B-矩阵求和-题解"><a href="#P8670-蓝桥杯-2018-国-B-矩阵求和-题解" class="headerlink" title="P8670 [蓝桥杯 2018 国 B] 矩阵求和 题解"></a>P8670 [蓝桥杯 2018 国 B] 矩阵求和 题解</h1><h3 id="前置芝士-题目"><a href="#前置芝士-题目" class="headerlink" title="前置芝士 / 题目"></a>前置芝士 / 题目</h3><ul><li>$\gcd$ 的性质</li><li>欧拉函数 $\varphi$ 及其性质</li></ul><p>前置题目:<a href="https://www.luogu.com.cn/problem/P2398">P2398</a> GCD SUM。</p><h3 id="思路"><a href="#思路" class="headerlink" title="思路"></a>思路</h3><p>简要题意:求 </p><script type="math/tex; mode=display">\sum_{i=1}^{n} \sum_{j=1}^{n} \gcd(i,j)^2</script><p>首先枚举暴力,肯定 T 飞,期望得分 <a href="https://www.luogu.com.cn/record/106794470">30pts</a>。</p><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// #include &lt;algorithm&gt;</span></span><br><span class="line"><span class="keyword">for</span> (reg <span class="type">int</span> i = <span class="number">1</span>; i &lt;= n; ++i)</span><br><span class="line"> ans = (ans + (i * i) % mod) % mod;</span><br><span class="line"><span class="keyword">for</span> (reg <span class="type">int</span> i = <span class="number">2</span>; i &lt;= n; ++i)</span><br><span class="line"> <span class="keyword">for</span> (reg <span class="type">int</span> j = <span class="number">1</span>; j &lt;= i - <span class="number">1</span>; ++j)</span><br><span class="line"> ans += <span class="number">2</span> * __gcd(i, j) * __gcd(i, j);</span><br></pre></td></tr></table></figure><p>不会用莫比乌斯反演,乱搞一下。<br>类似的带 $\gcd$ 的结论:</p><script type="math/tex; mode=display">\begin{aligned}\sum_{i=1}^{n} \sum_{j=1}^{n} f\left(\gcd(i,j)\right) &=\sum_{d=1}^{n} d \sum_{i=1}^{n} \sum_{j=1}^{n} [f \left( \gcd(i, j) \right)=d] \\&=\sum_{d=1}^{n} f\left(d\right) \sum_{i=1}^{n} \sum_{j=1}^{n} [\gcd(i, j)=d] \\&=\sum_{d=1}^{n} f\left(d\right) \sum_{i=1}^{\lfloor \frac{n}{d} \rfloor} \sum_{j=1}^{\lfloor \frac{n}{d} \rfloor} [\gcd(i, j)=1]\end{aligned}</script><p>$[\gcd(i,j)=1]$ 不就是两者互质么,那么来个欧拉函数解决问题。 </p><p>参考 <a href="https://www.luogu.com.cn/problem/P2158">P2158</a> [SDOI2008] 仪仗队,排除掉重复计算。</p><script type="math/tex; mode=display">\begin{aligned}\sum_{d=1}^{n} f\left(d\right) \sum_{i=1}^{\lfloor \frac{n}{d} \rfloor} \sum_{j=1}^{\lfloor \frac{n}{d} \rfloor} [\gcd(i, j)=1]&=\sum_{d=1}^{n} f\left(d\right) \left( 2 \times \sum_{i=1}^{\lfloor \frac{n}{d} \rfloor} \varphi\left(n\right)-1 \right)\end{aligned}</script><p>有了这个结论就可以愉快的刷<a href="https://www.luogu.com.cn/paste/kyn1fe72">多倍经验</a>了。</p><h3 id="贴个代码"><a href="#贴个代码" class="headerlink" title="贴个代码"></a>贴个代码</h3><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">inline</span> <span class="type">void</span> <span class="title">Euler</span><span class="params">(i64 n)</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">phi[<span class="number">1</span>] = <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">for</span> (reg <span class="type">int</span> i = <span class="number">2</span>; i &lt;= n; ++i)</span><br><span class="line"> &#123;</span><br><span class="line"> <span class="keyword">if</span> (!prime[i]) prime[++prime[<span class="number">0</span>]] = i, phi[i] = i - <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">for</span> (reg <span class="type">int</span> j = <span class="number">1</span>; j &lt;= prime[<span class="number">0</span>] &amp;&amp; i * prime[j] &lt;= n; ++j)</span><br><span class="line"> &#123;</span><br><span class="line"> prime[i * prime[j]] = <span class="number">1</span>;</span><br><span class="line"> <span class="keyword">if</span> (!(i % prime[j])) &#123; </span><br><span class="line"> phi[i * prime[j]] = phi[i] * prime[j]; <span class="keyword">break</span>; &#125;</span><br><span class="line"> <span class="keyword">else</span> phi[i * prime[j]] = phi[i] * phi[prime[j]];</span><br><span class="line"> &#125;</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">for</span> (reg <span class="type">int</span> i = <span class="number">1</span>; i &lt;= n; ++i)</span><br><span class="line"> phisum[i] = phisum[i - <span class="number">1</span>] + phi[i];</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="type">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line"><span class="built_in">Euler</span>(n);</span><br><span class="line"><span class="keyword">for</span> (reg i64 i = <span class="number">1</span>; i &lt;= n; ++i)</span><br><span class="line"> ans = (ans + ((i * i) % mod) * ((phisum[n / i] * <span class="number">2</span> - <span class="number">1</span>) % mod) % mod) % mod;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>]]></content>
<content type="html"><![CDATA[<h3 id="简要题意"><a href="#简要题意" class="headerlink" title="简要题意"></a>简要题意</h3><p>连结圆上 $n$ 个点,求最多能够把圆分成几个部分。</p><h3 id="前置知识"><a href="#前置知识" class="headerlink" title="前置知识"></a>前置知识</h3><p>欧拉公式:$F(ace)=E(dge) - V(ertex)+2$</p><p>人话:$\text{多边形面数} = \text{边数} - \text{顶点数} + 2$</p><h3 id="思路"><a href="#思路" class="headerlink" title="思路"></a>思路</h3><p>将一个圆折叠成一个多面体,你可以进行一些奇妙的空间变换来达到这一点。</p><p>那么我们最后会多出一个底面。</p><p>因此在我们的这个圆中 $F(n)=E-V+1$</p><h4 id="求-V"><a href="#求-V" class="headerlink" title="求 $V$"></a>求 $V$</h4><p>圆上已经有了 $n$ 个点。我们要使得圆内不存在三线共点的情况。</p><p>那么考虑每次选择四个顶点画出一个四边形的两条对角线。</p><p>于是又会生成 $C_{n}^{4}$ 个顶点。可以证明已经考虑完全了,于是有</p><script type="math/tex; mode=display">V = n + C_{n}^{4}</script><h4 id="求-E"><a href="#求-E" class="headerlink" title="求 $E$"></a>求 $E$</h4><p>原有 $C_{n}^{2}$ 条边,且圆环上的 $n$ 个点互相连接构成 $n$ 条边。</p><p>每多一个交点会增加两条多边形边。又有 $2\times C_{n}^{4}$ 条。</p><script type="math/tex; mode=display">E = n + C_{n}^{2} + 2\times C_{n}^{4}</script><p>最后,我们展开这个逆天的柿子:</p><script type="math/tex; mode=display">\begin{aligned} F(n) &= E - V + 1 \\ &= n + C_{n}^{2} + 2\times C_{n}^{4} - n - C_{n}^{4} + 1 \\ &= C_{n}^{2} + C_{n}^{4} + 1 \\ &= \dfrac{n(n - 1)}{2} + \dfrac{n(n - 1)(n - 2)(n - 3)}{4} + 1 \\ &= \dfrac{x^4}{24} - \dfrac{x^3}{4} + \dfrac{23x^2}{24} - \dfrac{3x}{4} + 1\end{aligned}</script><p>去 OEIS 上校验<a href="https://oeis.org/A000127" title="result">结果</a>,正确。</p>]]></content>




<summary type="html">&lt;h1 id=&quot;P8670-蓝桥杯-2018-国-B-矩阵求和-题解&quot;&gt;&lt;a href=&quot;#P8670-蓝桥杯-2018-国-B-矩阵求和-题解&quot; class=&quot;headerlink&quot; title=&quot;P8670 [蓝桥杯 2018 国 B] 矩阵求和 题解&quot;&gt;&lt;/a&gt;P8670 </summary>
<summary type="html">&lt;h3 id=&quot;简要题意&quot;&gt;&lt;a href=&quot;#简要题意&quot; class=&quot;headerlink&quot; title=&quot;简要题意&quot;&gt;&lt;/a&gt;简要题意&lt;/h3&gt;&lt;p&gt;连结圆上 $n$ 个点,求最多能够把圆分成几个部分。&lt;/p&gt;
&lt;h3 id=&quot;前置知识&quot;&gt;&lt;a href=&quot;#前置知识&quot; c</summary>





<category term="Test Posts" scheme="https://yttriumwillow.github.io/tags/Test-Posts/"/>
<category term="OI" scheme="https://yttriumwillow.github.io/tags/OI/"/>

</entry>

Expand Down
Loading

0 comments on commit 3d273fd

Please sign in to comment.