<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>梓旭的藏書閣</title>
        <link>https://zixu.eu.org/</link>
        <description>Zixu’s Bookshelf</description>
        <lastBuildDate>Fri, 02 Oct 2026 06:00:45 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en-US</language>
        <copyright>All rights reserved 2026, Zixu</copyright>
        <item>
            <title><![CDATA[JPS 學習筆記]]></title>
            <link>https://zixu.eu.org/article/JPS_學習筆記</link>
            <guid>https://zixu.eu.org/article/JPS_學習筆記</guid>
            <pubDate>Thu, 06 Feb 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-192ee6637440808aaa0ef081d155d162"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-192ee66374408027a39fc85c9cdbf013">Paper:</div><div class="notion-file notion-block-192ee663744080039d1ee34a27585f50"><a class="notion-file-link" href="https://file.notion.so/f/f/914059b4-1ebc-4e95-a151-069128eeec2c/e0841278-5a4e-472a-96fc-9829285da107/harabor-grastien-aaai11.pdf?table=block&amp;id=192ee663-7440-8003-9d1e-e34a27585f50&amp;spaceId=914059b4-1ebc-4e95-a151-069128eeec2c&amp;expirationTimestamp=1790949600000&amp;signature=ctr_PD1CrKTkhp6B98AVETBYIc1fVK8V3N5hG7IhAI8" target="_blank" rel="noopener noreferrer"><svg class="notion-file-icon" viewBox="0 0 30 30"><path d="M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z"></path></svg><div class="notion-file-info"><div class="notion-file-title">harabor-grastien-aaai11.pdf</div><div class="notion-file-size">170.2KB</div></div></a></div><div class="notion-blank notion-block-192ee663744080479a0ecba20bfa3afe"> </div><ul class="notion-list notion-list-disc notion-block-192ee663744080388262d0ce2cb975bf"><li>JPS: Jump Point Search</li></ul><details class="notion-toggle notion-block-192ee663744080d29e2cd9f20f6292f5"><summary>A* vs. JPS</summary><div><table class="notion-simple-table notion-block-192ee66374408086838bc9fb1c5580ef"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-192ee663744080efa05de90e68648305"><td class="notion-simple-table-header-cell" style="width:54.427085876464844px"><div class="notion-simple-table-cell">ㅤ</div></td><td class="" style="width:68.42708587646484px"><div class="notion-simple-table-cell">A*</div></td><td class="" style="width:63.427085876464844px"><div class="notion-simple-table-cell">JPS</div></td><td class="" style="width:65.42708587646484px"><div class="notion-simple-table-cell">JPS-Bit</div></td><td class="" style="width:103.42708587646484px"><div class="notion-simple-table-cell">JPS-BitPrune</div></td><td class="" style="width:96.42857142857143px"><div class="notion-simple-table-cell">JPS-BitPre</div></td><td class="" style="width:133.42708587646484px"><div class="notion-simple-table-cell">JPS-BitPrunePre</div></td></tr><tr class="notion-simple-table-row notion-block-192ee663744080c98185c611869c569e"><td class="notion-simple-table-header-cell" style="width:54.427085876464844px"><div class="notion-simple-table-cell">耗時</div></td><td class="" style="width:68.42708587646484px"><div class="notion-simple-table-cell">25.5ms</div></td><td class="" style="width:63.427085876464844px"><div class="notion-simple-table-cell">1.7ms</div></td><td class="" style="width:65.42708587646484px"><div class="notion-simple-table-cell">320us</div></td><td class="" style="width:103.42708587646484px"><div class="notion-simple-table-cell">230us</div></td><td class="" style="width:96.42857142857143px"><div class="notion-simple-table-cell">200us</div></td><td class="" style="width:133.42708587646484px"><div class="notion-simple-table-cell">95us</div></td></tr><tr class="notion-simple-table-row notion-block-192ee6637440809ba46fe3aecf4589d8"><td class="notion-simple-table-header-cell" style="width:54.427085876464844px"><div class="notion-simple-table-cell">速度</div></td><td class="" style="width:68.42708587646484px"><div class="notion-simple-table-cell">1x</div></td><td class="" style="width:63.427085876464844px"><div class="notion-simple-table-cell">15x</div></td><td class="" style="width:65.42708587646484px"><div class="notion-simple-table-cell">81x</div></td><td class="" style="width:103.42708587646484px"><div class="notion-simple-table-cell">110x</div></td><td class="" style="width:96.42857142857143px"><div class="notion-simple-table-cell">130x</div></td><td class="" style="width:133.42708587646484px"><div class="notion-simple-table-cell">273x</div></td></tr></tbody></table></div></details><details class="notion-toggle notion-block-192ee663744080b5b464f5925c5d642f"><summary>基於 A* 的優化</summary><div></div></details><details class="notion-toggle notion-block-192ee66374408051b5d7cda80c6adf97"><summary>JPS 基於當前節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的方向，遵循”兩個定義，三個規則”決定 Forced Neighbour(FN)</summary><div><ul class="notion-list notion-list-disc notion-block-192ee663744080c39ca5f444ccde5571"><li>定義一 FN</li><ul class="notion-list notion-list-disc notion-block-192ee663744080c39ca5f444ccde5571"><li>如果節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的鄰居，並且節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的鄰居有障礙物，並且從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>, <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>, <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的路徑長度比其他任何從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 且不經過 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的路徑更短 ⇒ 則 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的 FN，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的跳點。(圖1中，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的FN，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的跳點 )</li></ul></ul><ul class="notion-list notion-list-disc notion-block-192ee663744080498f5edfadc52762bb"><li>定義二 跳點</li><ul class="notion-list notion-list-disc notion-block-192ee663744080498f5edfadc52762bb"><li>如果節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是起點或目標點，則 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是跳點。(圖1中的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 與 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> )</li><li>如果 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 有 FN ⇒ 則 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是跳點 (圖1中的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> )</li><li>如果 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是對角線移動，並且 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 經過水平或垂直方向可以到達跳點 ⇒ 則 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是跳點 (圖1中的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>)</li></ul></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440808e98a8f5b686a1be45"><li>規則一</li><ul class="notion-list notion-list-disc notion-block-192ee6637440808e98a8f5b686a1be45"><li>在搜尋跳點的過程中，優先搜尋直線方向，再搜尋對角線方向</li></ul></ul><ul class="notion-list notion-list-disc notion-block-192ee66374408040964dc0ee2e3d207c"><li>規則二</li><ul class="notion-list notion-list-disc notion-block-192ee66374408040964dc0ee2e3d207c"><li>如果從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是直線移動，且 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的鄰居，若存在 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的路徑不經過 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 且路徑長度<span class="notion-inline-underscore">小於等於</span> <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 經過 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的路徑，則走到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 以後下一個點不會走到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> </li><li>如果從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是對角線移動，且 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的鄰居，若存在 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的路徑不經過 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 且路徑長度<b><span class="notion-inline-underscore">小於</span></b>從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 經過 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的路徑，則走到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 以後下一個點不會走到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></ul><ul class="notion-list notion-list-disc notion-block-192ee663744080e687bae64a720a50d5"><li>規則三</li><ul class="notion-list notion-list-disc notion-block-192ee663744080e687bae64a720a50d5"><li>只有跳點才會加入 openset，因為跳點會改變行走方向(非跳點無法改變方向)，最後尋找出來的路徑點都是跳點</li></ul></ul></div></details><details class="notion-toggle notion-block-192ee6637440803faf0fdaedfc4cb6aa"><summary>根據當前方向來決定下一個跳點</summary><div><ul class="notion-list notion-list-disc notion-block-192ee66374408020afeef1765ba504b4"><li>Case 1. 當前方向是直線 </li><ul class="notion-list notion-list-disc notion-block-192ee66374408020afeef1765ba504b4"><li>Case 1.1 目前<span class="notion-red">左後方</span>不可走且<span class="notion-red">左方</span>可走 ⇒ 沿<span class="notion-red">左前方</span>與<span class="notion-red">左方</span>找不在 closedset 的跳點</li><li>Case 1.2 目前當前方向可走 ⇒ 沿著當前方向尋找不在 closedset 的跳點</li><li>Case 1.3 目前<span class="notion-red">右後方</span>不可走且<span class="notion-red">右方</span>可走 ⇒ 沿<span class="notion-red">右前方</span>與<span class="notion-red">右方</span>找不在 closedset 的跳點</li></ul></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440800c9198dbe818c3feb4"><li>Case 2. 當前方向是對角線 </li><ul class="notion-list notion-list-disc notion-block-192ee6637440800c9198dbe818c3feb4"><li>Case 2.1 目前的水平分量可走 ⇒ 沿水平分量方向尋找不在 closedset 的跳點</li><li>Case 2.2 目前當前方向可走 ⇒ 沿著當前方向尋找不在 closedset 的跳點</li><li>Case 2.3 目前的垂直分量可走 ⇒ 沿垂直方量方向尋找不在 closedset 的跳點</li></ul></ul></div></details><details class="notion-toggle notion-block-192ee6637440806faf93ec56606fbff4"><summary>JSP 的三種優化</summary><div><ul class="notion-list notion-list-disc notion-block-192ee66374408040bfabf0f1c880e67f"><li>Bit Operation</li></ul><ul class="notion-list notion-list-disc notion-block-192ee663744080b7a6acdc8ad259bc8d"><li>Preprocessing</li></ul><ul class="notion-list notion-list-disc notion-block-192ee663744080bcb692ebc171e7cd83"><li>Prune</li></ul></div></details><details class="notion-toggle notion-block-192ee6637440802b86ebd1a48cf6cf4b"><summary>算法流程圖</summary><div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-192ee66374408012a5deccb6556f6052"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Afc486bdd-2ef7-44d4-a437-9c2364fe3dd0%3Aimage.png?table=block&amp;id=192ee663-7440-8012-a5de-ccb6556f6052&amp;t=192ee663-7440-8012-a5de-ccb6556f6052" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></details><details class="notion-toggle notion-block-192ee6637440800cb4d7e3a7c8b2d7e0"><summary>圖一</summary><div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-192ee6637440800babeee249dd847857"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:338px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A2be14b09-c213-4f90-a9fc-315810dfb7ae%3Aimage.png?table=block&amp;id=192ee663-7440-800b-abee-e249dd847857&amp;t=192ee663-7440-800b-abee-e249dd847857" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></details><details class="notion-toggle notion-block-192ee663744080d191cff34be53d658a"><summary>來看個例子</summary><div><ul class="notion-list notion-list-disc notion-block-192ee663744080faa213f8de5a0e66e2"><li>圖請見圖一</li></ul><ul class="notion-list notion-list-disc notion-block-192ee66374408039bd58f0ef4d8c3164"><li>目標: 尋找從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的最短路徑，且不能經過黑色區域</li></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440803aa364f8b5908e372b"><li>螢幕參考座標系(<span class="notion-blue">上下左右</span>)、人物參考坐標系(<span class="notion-red">前後左右</span>)</li></ul><ol start="1" class="notion-list notion-list-numbered notion-block-192ee6637440809c89ebc1a72a7105ed" style="list-style-type:decimal"><li>將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 加入 openset</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-192ee663744080bba446eea5eda5eabd" style="list-style-type:decimal"><li>從 openset 中取出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 值最小的節點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-192ee663744080719656f8c4bef5e95f" style="list-style-type:decimal"><li>將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 從 openset 中刪除，加入 closedset</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-192ee6637440808eb93cebbf4be7448e" style="list-style-type:decimal"><li>當前方向為空，往八個方向擴散，三個選項為<span class="notion-blue"><b>右、下、右下</b></span></li><ol class="notion-list notion-list-numbered notion-block-192ee6637440808eb93cebbf4be7448e" style="list-style-type:lower-alpha"><li>往<span class="notion-blue">右</span> ⇒ 撞到牆</li><li>往<span class="notion-blue">下</span> ⇒ 撞到邊界</li><li>往<span class="notion-blue">右下</span> ⇒ 根據定義二第三條，<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為 S，右下是對角線移動，並且 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 透過垂直移動可以到達跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為跳點，將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 加入 openset</li></ol></ol><ol start="5" class="notion-list notion-list-numbered notion-block-192ee6637440803a8f83dc3b914a3668" style="list-style-type:decimal"><li>從 openset 中取出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 值最小的節點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="6" class="notion-list notion-list-numbered notion-block-192ee66374408008a527f67300b739f1" style="list-style-type:decimal"><li>將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 從 openset 中刪除，加入 closedset</li></ol><ol start="7" class="notion-list notion-list-numbered notion-block-192ee6637440803a8d97e1e820b0d337" style="list-style-type:decimal"><li>當前方向( <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 看向 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> )為<span class="notion-blue"><b>右下</b></span>，往<span class="notion-blue">右、下、右下</span>三個方向擴散(Case 2)</li><ol class="notion-list notion-list-numbered notion-block-192ee6637440803a8d97e1e820b0d337" style="list-style-type:lower-alpha"><li>往<span class="notion-blue">右</span> ⇒ 撞到牆</li><li>往<span class="notion-blue">右下</span> ⇒ 撞到牆</li><li>往<span class="notion-blue">下</span> ⇒ 根據定義二第二條，找到跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 加入 openset</li></ol></ol><ol start="8" class="notion-list notion-list-numbered notion-block-192ee66374408009ab61c16e0546a12f" style="list-style-type:decimal"><li>從 openset 中取出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 值最小的節點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="9" class="notion-list notion-list-numbered notion-block-192ee663744080058959d2d5486838be" style="list-style-type:decimal"><li>當前方向( <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 看向 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> )為向<span class="notion-blue">下</span>，往<span class="notion-blue"><b>右、右下</b></span>(Case1.1中的<span class="notion-red">左</span>與<span class="notion-red">左前</span>)與<span class="notion-blue"><b>下</b></span>(Case1.2)擴散</li><ol class="notion-list notion-list-numbered notion-block-192ee663744080058959d2d5486838be" style="list-style-type:lower-alpha"><li>往<span class="notion-blue"><b>下</b></span> ⇒ 撞到邊界</li><li>往<span class="notion-blue">右下</span> ⇒ 撞到邊界</li><li>往<span class="notion-blue">右</span> ⇒ 根據定義二第二條，透過 FN <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 找到跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 加入 openset</li></ol></ol><ol start="10" class="notion-list notion-list-numbered notion-block-192ee6637440807c9e67da7d7c861e2c" style="list-style-type:decimal"><li>從 openset 中取出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 值最小的節點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="11" class="notion-list notion-list-numbered notion-block-192ee66374408004a39adcfc91699645" style="list-style-type:decimal"><li>當前方向( <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>看向牆壁)為向<span class="notion-blue">右</span>，往<span class="notion-blue"><b>上、右上</b></span>(Case 1.1)<b>與</b><span class="notion-blue">右</span>(Case 1.2)擴散</li><ol class="notion-list notion-list-numbered notion-block-192ee66374408004a39adcfc91699645" style="list-style-type:lower-alpha"><li>往<span class="notion-blue">右</span> ⇒ 撞到邊界</li><li>往<span class="notion-blue">右上</span> ⇒ 撞到邊界</li><li>往<span class="notion-blue">上</span> ⇒ 根據定義二第一條，找到跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 加入 openset</li></ol></ol><ol start="12" class="notion-list notion-list-numbered notion-block-192ee6637440802ab342c40915a3b41f" style="list-style-type:decimal"><li>從 openset 中取出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 值最小的節點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="13" class="notion-list notion-list-numbered notion-block-192ee66374408068998ac2f3a9e7ef47" style="list-style-type:decimal"><li>找到目標點，尋路結束，路徑為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol></div></details><details class="notion-toggle notion-block-192ee66374408091803dee835071739b"><summary>JPS 快在哪</summary><div><ul class="notion-list notion-list-disc notion-block-192ee6637440800aa378ddbce8a71a41"><li>A* 在從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 時，會將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 加入到 openset 中，才能走出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 或是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-192ee66374408037ab6ad2ec8b987e3a"><li>JPS 只用到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-192ee663744080ca9132e611e42fe32a"><li>對 heap 來說，插入與刪除節點(更新openset與closedset)的複雜度為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-192ee66374408035be4decc2b69eed52"><summary>JPS-Bit</summary><div><ul class="notion-list notion-list-disc notion-block-192ee663744080c9b515d763ef11ebb1"><li>使用 bit operation 來優化</li></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440807ebcdcc176ce9fe641"><li>使用 0 表示可走的節點，1表示不可走的節點</li></ul><details class="notion-toggle notion-block-192ee663744080a68d08dc7e9a783270"><summary>圖二</summary><div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-192ee663744080a79ea2f9f26a41fb54"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:532px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A954baddf-3408-40d4-9c77-9dc6243619db%3Aimage.png?table=block&amp;id=192ee663-7440-80a7-9ea2-f9f26a41fb54&amp;t=192ee663-7440-80a7-9ea2-f9f26a41fb54" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></details><ul class="notion-list notion-list-disc notion-block-192ee66374408092a306d25717c9c2fd"><li><code class="notion-inline-code">__builtin_clz(B)</code>: 返回前導 0 的個數</li></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440804a95f4d0ca3d001003"><li>尋找當前的跳點: <code class="notion-inline-code">__builtin_clz(((B-&gt;&gt;1) &amp;&amp; !B-) || ((B+&gt;&gt;1) &amp;&amp; !B+))</code></li></ul><ul class="notion-list notion-list-disc notion-block-192ee66374408025a10bf00238a86aa2"><li>本例中<code class="notion-inline-code">__builtin_clz(((00000000) &amp;&amp; 11111111) || ((00011000) &amp;&amp; (11001111)))</code> = <code class="notion-inline-code">00001000</code> = 4，從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 往當前方向(<span class="notion-blue">向右</span>)數四格的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 即為下一個跳點</li></ul></div></details><details class="notion-toggle notion-block-192ee663744080b88f9be19d3ca5dbf5"><summary>JPS-BitPrune</summary><div><ul class="notion-list notion-list-disc notion-block-192ee663744080db84d2d1cca4645f55"><li>基於 JPS-Bit 之上進行剪枝，刪除不必要的中間跳點，尋訪到完整路徑之後以拐點替代</li></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440803782e7c2bc9620619e"><li>增加拐點</li><ul class="notion-list notion-list-disc notion-block-192ee6637440803782e7c2bc9620619e"><li>假設節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 座標為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li><li>如果 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 或 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 與 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 在同一個直線上 ⇒ 走直線就好，不用加拐點</li><li>如果 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 與 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 在對角線方向上 ⇒ 直線到達即可，不用加拐點</li><li>除此之外的情況，說明兩個點不在同一個對角線上，並且中間可能存在障礙物，需要加上一個中間跳點作為拐點</li><li>選擇拐點的策略: 離 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 點最近的中間跳點(從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 沿對角線走 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 步的點)</li></ul></ul><details class="notion-toggle notion-block-192ee663744080a498cfe50d148eb1b6"><summary>再看個例子</summary><div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-192ee66374408043bfeaf9928db6eff2"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ab562b047-1e6c-4921-a7a3-a8f3aff7b242%3Aimage.png?table=block&amp;id=192ee663-7440-8043-bfea-f9928db6eff2&amp;t=192ee663-7440-8043-bfea-f9928db6eff2" alt="notion image" loading="lazy" decoding="async"/></div></figure><ul class="notion-list notion-list-disc notion-block-192ee663744080ecabfac37f01870d53"><li>起點: <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，目標: <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440800f9c00c27c5e40016e"><li>節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是為了到達結點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 或結點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的中間跳點</li></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440807a8d7afeac7d65f5f4"><li>節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是為了達到節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的中間跳點</li></ul><ol start="1" class="notion-list notion-list-numbered notion-block-192ee6637440802ead04f273180c637a" style="list-style-type:decimal"><li>從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 開始尋找跳點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-192ee6637440807f9887e4a8f4a77b14" style="list-style-type:decimal"><li>在 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的直線方向找到跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 與 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ，將兩個跳點的父跳點設為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-192ee6637440800d93b0e3c4647ba35a" style="list-style-type:decimal"><li>繼續從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的對角線找跳點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-192ee6637440807eae19d98222012f2e" style="list-style-type:decimal"><li>往 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的直線方向找到跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，將跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的父跳點設為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-192ee663744080d9bcb8c8de441ba1fa" style="list-style-type:decimal"><li>繼續從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的對角線找跳點 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="6" class="notion-list notion-list-numbered notion-block-192ee6637440804f8a1cc72f64f92721" style="list-style-type:decimal"><li>往 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的直線方向找到跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，將跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的父跳點設為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="7" class="notion-list notion-list-numbered notion-block-192ee6637440802db001c1fd6148a059" style="list-style-type:decimal"><li>得到路徑 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，因兩者無法走直線及對角線 ⇒ 需要加入中間拐點</li></ol><ol start="8" class="notion-list notion-list-numbered notion-block-192ee663744080639d96e00a596fcc16" style="list-style-type:decimal"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ， <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>， <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="9" class="notion-list notion-list-numbered notion-block-192ee6637440807c91addce0a93c2845" style="list-style-type:decimal"><li>從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 往對角線走 3 步，將節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 設為中間拐點</li></ol><ol start="10" class="notion-list notion-list-numbered notion-block-192ee663744080e9adcdfc3a130fb5d7" style="list-style-type:decimal"><li>最終路徑為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ul class="notion-list notion-list-disc notion-block-192ee663744080f4bc89f209d4747297"><li>未剪枝 vs. 剪枝</li><ul class="notion-list notion-list-disc notion-block-192ee663744080f4bc89f209d4747297"><li>未剪枝: <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li><li>剪枝: <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></ul></div></details></div></details><details class="notion-toggle notion-block-192ee663744080e6b77dcae6dcc978fc"><summary>JPS-BitPre</summary><div><ul class="notion-list notion-list-disc notion-block-192ee663744080fab8aaff72d4ec96d3"><li>不支援動態阻擋</li></ul><ul class="notion-list notion-list-disc notion-block-192ee6637440801c9077e15ad415a0b2"><li>空間換取時間</li></ul><ul class="notion-list notion-list-disc notion-block-192ee663744080749266d46ce5d8858e"><li>前處理的內容: 每個點儲存八個方向分別可以走幾步</li></ul><details class="notion-toggle notion-block-192ee66374408062b909ceaad0adfb5b"><summary>最後一個例子</summary><div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-192ee663744080c8bddbf80a7352f291"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:482px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aa6512de6-3d2b-4834-90f4-b8673bdca009%3Aimage.png?table=block&amp;id=192ee663-7440-80c8-bddb-f80a7352f291&amp;t=192ee663-7440-80c8-bddb-f80a7352f291" alt="notion image" loading="lazy" decoding="async"/></div></figure><ol start="1" class="notion-list notion-list-numbered notion-block-192ee6637440807ea897d2f7c6863900" style="list-style-type:decimal"><li>取出節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-192ee66374408043bffbd39b4335559b" style="list-style-type:decimal"><li>取出八個方向最多走幾步，將該方向最遠可抵達的節點找出來 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-192ee663744080eabcbcc44348864e26" style="list-style-type:decimal"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 滿足定義二第三條，加入 openset</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-192ee663744080eebc6ec01d84e2d821" style="list-style-type:decimal"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 滿足定義二第二條，加入 openset</li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-192ee663744080ceae62e509aabc24f2" style="list-style-type:decimal"><li>剩下的節點中，因為終點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 位於 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的<span class="notion-blue">左下方</span>，因此只考慮方向同為左下角的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol><ol start="6" class="notion-list notion-list-numbered notion-block-192ee663744080deb80bcedacacb959f" style="list-style-type:decimal"><li>從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的對角線走 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 步，即節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，加入 openset</li></ol><ol start="7" class="notion-list notion-list-numbered notion-block-192ee66374408053821debf1dbcda261" style="list-style-type:decimal"><li>從 openset 中取出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 值最小的節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，垂直方向找到跳點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，加入 openset</li></ol><ol start="8" class="notion-list notion-list-numbered notion-block-192ee663744080b69f97ea2f5efb9189" style="list-style-type:decimal"><li>從 openset 中取出 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 值最小的節點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，搜索結束</li></ol><ol start="9" class="notion-list notion-list-numbered notion-block-192ee6637440805e9710c032092c7a69" style="list-style-type:decimal"><li>路徑為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ol></div></details></div></details><details class="notion-toggle notion-block-192ee663744080e38d3cc6ec64c87076"><summary>Ref</summary><div><div class="notion-text notion-block-192ee663744080a3b018dab5e110068d"><a class="notion-link" href="https://runzhiwang.github.io/2019/06/21/jps/" target="_blank" rel="noopener noreferrer">主要參考文章</a></div><div class="notion-text notion-block-192ee663744080e8b6aec4c3dd1f05dd"><a class="notion-link" href="https://github.com/fgenesis/tinypile/blob/master/jps.hh" target="_blank" rel="noopener noreferrer">C Code</a></div><div class="notion-text notion-block-192ee66374408044a5ead703975df1d0"><a class="notion-link" href="https://github.com/YYRise/jps/blob/master/jps.py" target="_blank" rel="noopener noreferrer">Python Code</a></div></div></details><div class="notion-blank notion-block-192ee663744080a99a0eecab69d7d26b"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AP325 隨筆]]></title>
            <link>https://zixu.eu.org/article/AP325_隨筆</link>
            <guid>https://zixu.eu.org/article/AP325_隨筆</guid>
            <pubDate>Mon, 03 Mar 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-1abee663744080b2953aef10d1d43770"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><details class="notion-toggle notion-block-1aeee66374408097a1caec3651d2f078"><summary>目錄</summary><div><div class="notion-table-of-contents notion-gray notion-block-1abee663744080c189b5cfdc04552b13"><a href="#1aeee6637440805b8aadc4658d813518" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch00. 前言</span></a><a href="#1abee663744080a09f87c9a7e5f6017f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch01. Recursion</span></a><a href="#1abee6637440802a8809f38a5ae903ce" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d001. P-1-1. 合成函數(1)</span></a><a href="#1abee6637440809d8c87e34d73cbfae3" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d002. Q-1-2. 合成函數(2)</span></a><a href="#1abee663744080b0ad6ee11f1c2371e5" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d003. P-1-3. 棍子中點切割</span></a><a href="#1abee6637440808dba24e134cc0a99ab" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d004. Q-1-4. 支點切割</span></a><a href="#1adee663744080c88696c026ea4e8bd7" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d005. Q-1-5. 二維黑白影像編碼</span></a><a href="#1adee66374408077a4e7ccf54aa17704" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d006. P-1-7. 子集合乘積</span></a><a href="#1adee6637440807b9de4deb4383cbbd0" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d007. Q-1-8. 子集合的和</span></a><a href="#1adee66374408031986cc80325236f04" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d008. Q-1-10. 最多得分的皇后</span></a><a href="#1adee6637440809f983afd5d2998299f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d009. Q-1-11. 刪除矩形邊界</span></a><a href="#1aeee663744080749c27f648696b7bd5" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch02. Sort &amp; Binary Search</span></a><a href="#1aeee6637440808b96b9ef62130715f1" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d010. P-2-1. 不同的數</span></a><a href="#1aeee663744080dfac66dde2e23e4c24" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d011. P-2-2. 離散化</span></a><a href="#1aeee663744080cfa870ce292f3255bb" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d012. P-2-3. 快速冪</span></a><a href="#1aeee66374408054b7aae792bf54db89" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d013. Q-2-4. 快速冪 2</span></a><a href="#1aeee66374408005ad52f5253616f875" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d014. Q-2-5. 快速計算費式數列第 n 項</span></a><a href="#1aeee663744080cfaa0eeef528872094" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d015. P-2-6. Two-Number problem</span></a><a href="#1aeee663744080418b9dfd2987525a46" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d016. Q-2-7. 互補團隊</span></a><a href="#1aeee66374408098b59ac803db96e1da" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d017. Q-2-8. 模逆元</span></a><a href="#1aeee663744080c88fbae6e390b4c1dd" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d018. P-2-9. 子集合乘積</span></a><a href="#1aeee663744080c4a665d53a09290841" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d019. Q-2-10. 子集合的和</span></a><a href="#1aeee663744080bd8838d8c1946875e0" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d020. P-2-11. 最接近的區間和</span></a><a href="#1aeee6637440806c8ea7eb8fc326bff6" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d021. Q-2-12. 最接近的子矩陣和</span></a><a href="#1aeee663744080b48e7bfd0d9d59adcc" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d022. Q-2-13. 無理數的快速冪</span></a><a href="#1afee6637440806a98eac316308bdfe9" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d023. Q-2-14. 水槽</span></a><a href="#1b0ee663744080c4b26fca4ba0af56b4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d024. P-2-15. 圓環出口</span></a><a href="#1afee6637440803baf2cde8ec66e1916" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch03. Queue &amp; Stack</span></a><a href="#1afee663744080e7a112d651db1641d6" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d025. P-3-1. 樹的高度與根</span></a><a href="#1b0ee66374408082b0ede774121af5ca" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d026. P-3-2. 括弧配對</span></a><a href="#1b0ee663744080628bc8cd81ad1377ff" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d027. Q-3-3. 加減乘除</span></a><a href="#1b0ee663744080f985eae6a20a7df0b9" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d028. P-3-4. 最接近的高人</span></a><a href="#1b0ee663744080018654c262beeb65f0" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d029. Q-3-5. 帶著板凳排雞排的高人</span></a><a href="#1b2ee663744080f98e46c7805b46f43f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d030. P-3-6. 砍樹</span></a><a href="#1b2ee6637440809584fde5cf22a0215e" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d031. P-3-7. 正整數序列之最接近的區間和</span></a><a href="#1b2ee663744080fcbbf2d7445b385854" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d032. P-3-8. 固定長度區間的最大區段差</span></a><a href="#1b2ee66374408070bf51ee6a78b17429" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d033. P-3-9. 最多色彩帶</span></a><a href="#1b2ee66374408076b18afb7df3fd26fc" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d034. P-3-10. 全彩彩帶</span></a><a href="#1b3ee66374408076aa34e30309019003" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d035. Q-3-11. 最長的相異色彩帶</span></a><a href="#1b3ee663744080fdb4c0d93040b6b804" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d036. Q-3-12. 完美彩帶</span></a><a href="#1b3ee66374408084ab87f9ea4b2423bf" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d037. Q-3-13. X差值範圍內的最大Y差值</span></a><a href="#1b3ee6637440805d8691f82bb7578bc4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d038. Q-3-14. 線性函數</span></a><a href="#1b4ee6637440805a9987c0cdb66966ce" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch04. Greedy &amp; Line Sweeping</span></a><a href="#1b4ee6637440800896dac912975252cd" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d042. P-4-1. 少林寺的代幣</span></a><a href="#1b4ee66374408072a07ed0e04162763d" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d043. P-4-2. 笑傲江湖之三戰</span></a><a href="#1b4ee663744080ba93c3f31f66e7e2f2" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d044. P-4-3. 十年磨一劍</span></a><a href="#1b4ee6637440802ab7e3de5730cf9d5c" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d045. P-4-4. 幾場華山論劍</span></a><a href="#1b4ee66374408044add2ccd7f5d0f958" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d046. P-4-5. 嵩山磨劍坊的問題</span></a><a href="#1b5ee663744080598698d06bede14ecf" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d047. Q-4-6. 少林寺的自動寄物櫃</span></a><a href="#1b5ee663744080b3931efbec7fbe1ac4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d048. P-4-7. 岳不群的併派問題</span></a><a href="#1b5ee663744080078618f96051618047" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d053. Q-4-8. 先到先服務</span></a><a href="#1b5ee663744080a5a70bce44d2f06779" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d049. P-4-9. 基地台</span></a><a href="#1b5ee663744080f097d6f0d50dd051b8" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d054. Q-4-10. 恢復能量的白雲熊膽丸</span></a><a href="#1b5ee663744080e18183fd63f04a44c1" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d050. P-4-11. 線段聯集</span></a><a href="#1b5ee663744080cba68de101b666bc8c" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d051. P-4-12. 一次買賣</span></a><a href="#1b5ee6637440807fae30c58785a876e0" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d052. P-4-13. 最大連續子陣列</span></a><a href="#1b6ee66374408019815ed490c606e559" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d055. P-4-14. 控制點</span></a><a href="#1b6ee663744080e4804ed122237eef3d" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d056. P-4-15. 最靠近的一對</span></a><a href="#1b6ee66374408087868cceefa6e80213" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d057. Q-4-16. 賺錢與罰款</span></a><a href="#1b6ee663744080de8295fb6aa1e99960" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d058. Q-4-17. 死線高手</span></a><a href="#1b6ee6637440805ab7b6e64252b063fb" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d059. Q-4-18. 少林寺的櫃姐</span></a><a href="#1b6ee663744080eea173dad2310d2a94" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d060. Q-4-19. 五嶽盟主的會議場所</span></a><a href="#1b6ee663744080749aeecdee6654e5e8" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d061. Q-4-20. 監看華山練功場</span></a><a href="#1b6ee66374408079b9b2eb7b05e6fc44" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch05. Divide &amp; Conquer</span></a><a href="#1b7ee663744080b49cc3d45be82197b8" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d064. P-5-4. 反序數量</span></a><a href="#1b7ee66374408056aac6d79dc9064fcc" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d065. P-5-7. 大樓外牆廣告</span></a><a href="#1b7ee663744080ee95f6ccffc19b0a57" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch06. Dynamic Programming</span></a><a href="#1b7ee6637440802bb72ae1041ad98679" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d066. P-6-1. 小朋友上樓梯最小成本</span></a><a href="#1b7ee663744080cd9452c7dfca619733" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d067. P-6-2. 不連續的表演酬勞</span></a><a href="#1b7ee6637440807b90acfc36b463f34f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d068. P-6-3. 最小監控鄰居的成本</span></a><a href="#1b7ee6637440808cb68bf7bdd2da1c41" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d072. Q-6-4. 闖關二選一</span></a><a href="#1b7ee6637440801d8fa4fdfa70547fa5" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d073. Q-6-5. 二維最大子矩陣</span></a><a href="#1b7ee66374408014b7c3e7a4ca53c666" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d069. P-6-6. 方格棋盤路線</span></a><a href="#1b7ee663744080a28a23d620d0f33dc4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d070. P-6-7. LCS</span></a><a href="#1b8ee6637440809995b8cecea89fa978" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d074. Q-6-8. Local alignment</span></a><a href="#1b7ee663744080ed95dffab58a2b8e35" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d071. P-6-9. 大賣場免費大搬家</span></a><a href="#1b8ee663744080e389c5d731a189705b" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d075. Q-6-10. 置物櫃出租</span></a><a href="#1b8ee663744080c69bd6d7ccf6053151" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d076. P-6-11. Catalan number</span></a><a href="#1b8ee66374408059bab2df386b47838a" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d084. Q-6-12. 楊鐵心做 1 休 K</span></a><a href="#1b8ee663744080539e43de955b801bbc" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d077. P-6-13. 周伯通的基地台</span></a><a href="#1b8ee663744080839653c8a3440d23b8" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d085. Q-6-14. K 次買賣</span></a><a href="#1b8ee663744080018afbd14a471ea64a" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d078. P-6-15. 一覽衆山小</span></a><a href="#1bfee663744080d5a47ff640307bdf50" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d118. P-6-16. 山寨華山論劍</span></a><a href="#1b8ee6637440800d88faff969b2fd7fa" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d079. P-6-17. 切棍子</span></a><a href="#1b8ee66374408098a7fece03baf7b5c6" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d086. Q-6-18. 矩陣乘法鏈</span></a><a href="#1b9ee663744080b0b0bafb176746d570" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d080. P-6-19. 階梯數字</span></a><a href="#1bbee663744080cd8906c20652e8dae1" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d081. P-6-20. Hyper-cube path</span></a><a href="#1bcee663744080f88f7dd03e887ed25b" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d082. P-6-21. 刪除邊界</span></a><a href="#1beee663744080eab030d4dc2b00e0b2" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d083. P-6-22. 文無第一武無第二</span></a><a href="#1c9ee663744080b4a022db00156f77b0" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d087. Q-6-23. 直升機抓寶</span></a><a href="#1c9ee663744080ada359e1a5f60bf297" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d088. Q-6-24. 隔離採礦</span></a><a href="#1c6ee663744080c1a0e6e602c31f6c75" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d089. Q-6-25. 貨郎問題</span></a><a href="#1c6ee663744080d5bc5ce7e419c0bb13" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Ch07. Graph</span></a><a href="#1c6ee6637440808ca0d4cf381814e6de" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d090. P-7-1. 探索距離</span></a><a href="#1c6ee66374408079abb7c6dea92d452b" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d091. P-7-2. 開車蒐集寶物</span></a><a href="#1c6ee663744080938d9cf0f3b40ef81b" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d092. P-7-3. 機器人走棋盤</span></a><a href="#1c7ee6637440804d929cc5923974c299" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d093. P-7-4. 方格棋盤的最少轉彎數路線</span></a><a href="#1d1ee6637440801b9f61c2027f457617" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d094. Q-7-5. 闖關路線</span></a><a href="#1d1ee663744080809249dad350b5f6d2" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d095. P-7-6. DAG 的最長與最短路徑</span></a><a href="#1d3ee66374408080bf77e38ed17dd834" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d099. Q-7-7. AOV 最早完工時間</span></a><a href="#1d3ee66374408017bcf2c24af8621c0f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d100. Q-7-8. 小寶的著色問題</span></a><a href="#1d1ee6637440802baeaad7ae634bcd74" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d096. P-7-9. 最短路徑</span></a><a href="#1d3ee66374408042ae59caf264f49b58" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d097. P-7-10. 挖坑跳</span></a><a href="#1d4ee66374408061a12aea4d7568bd30" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d101. Q-7-11. 紅白彩帶</span></a><a href="#1d4ee66374408064b88ad1c6bbb82d71" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">d098. P-7-12. 最小生成樹</span></a></div></div></details><details class="notion-toggle notion-block-1aeee6637440805b8aadc4658d813518"><summary><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1aeee6637440805b8aadc4658d813518" data-id="1aeee6637440805b8aadc4658d813518"><span><div id="1aeee6637440805b8aadc4658d813518" class="notion-header-anchor"></div><span class="notion-h-title">Ch00. 前言</span></span></h2></summary><div><h3 class="notion-h notion-h2 notion-block-1aeee6637440808f8140d16141ff619b" data-id="1aeee6637440808f8140d16141ff619b"><span><div id="1aeee6637440808f8140d16141ff619b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee6637440808f8140d16141ff619b" title="Ref"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ref</span></span></h3><ul class="notion-list notion-list-disc notion-block-1aeee66374408098a543f9c4a8bf6404"><li><a class="notion-link" href="https://hackmd.io/1Y42mnDzQSy6pV__2vvP3g" target="_blank" rel="noopener noreferrer">強者我朋友 Ray 的題解</a></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080ea99d1d6c7ab856532"><li><a class="notion-link" href="https://judge.tcirc.tw/problems/?category=3" target="_blank" rel="noopener noreferrer">中一中電研 OJ</a></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080bdb3a5ccc99434f8ae"><li><a class="notion-link" href="https://drive.google.com/drive/u/0/folders/10hZCMHH0YgsfguVZCHU7EYiG8qJE5f-m" target="_blank" rel="noopener noreferrer">AP325 官方講義與資源</a></li></ul><ul class="notion-list notion-list-disc notion-block-1b2ee663744080a9a468fc10e04bc9eb"><li><a class="notion-link" href="https://drive.google.com/drive/folders/10hZCMHH0YgsfguVZCHU7EYiG8qJE5f-m" target="_blank" rel="noopener noreferrer">AP325_v1.5.pdf</a></li></ul><h3 class="notion-h notion-h2 notion-block-1aeee6637440806e9adace33371825c2" data-id="1aeee6637440806e9adace33371825c2"><span><div id="1aeee6637440806e9adace33371825c2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee6637440806e9adace33371825c2" title="廢話"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><s>廢話</s></span></span></h3><div class="notion-text notion-block-1bbee663744080dd97a6f849773fe956">此文章並非為官方題解，僅是將我個人刷題的過程記錄下來，因此若有任何錯誤或令你不解的地方歡迎來信指教<s>或幫我寫</s>。</div><div class="notion-text notion-block-1bbee663744080d4899cd8c5d286c968">由於 AP325 官方教材已提供例題(P)的詳解，因此通常 P 的註解會比 Q 少，若想更好的掌握該題知識，仍需以教材所撰寫的內容為主。</div><div class="notion-text notion-block-1bbee6637440802c800acdbb33f0aacd">另外並非是每題都有筆記，太簡單的題目請直接吞服程式碼，若有不適可搭配適當分量的溫水。</div><div class="notion-text notion-block-1bbee663744080d78797d10eafc98188">最後提醒，AP325 教材所預設的閱讀對象是有一定程式基礎的初學者，因此我並不建議你將這份題單作為第一份題單。</div><div class="notion-blank notion-block-1bbee66374408007b84cfd8f1a0b2503"> </div><blockquote class="notion-quote notion-block-1aeee663744080f497c6e79204abe0c6"><div><em>裙子無法掩蓋傷疤，功勳戒指也無法遮蔽黑暗。
我想表達的是，苦難不應該被歌頌。
我們不該歌頌苦難，值得歌頌的是經歷苦難卻仍然掙扎著前行的人。</em></div></blockquote></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1abee663744080a09f87c9a7e5f6017f" data-id="1abee663744080a09f87c9a7e5f6017f"><span><div id="1abee663744080a09f87c9a7e5f6017f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1abee663744080a09f87c9a7e5f6017f" title="Ch01. Recursion"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ch01. Recursion</span></span></h2><details class="notion-toggle notion-block-1abee6637440802a8809f38a5ae903ce"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1abee6637440802a8809f38a5ae903ce" data-id="1abee6637440802a8809f38a5ae903ce"><span><div id="1abee6637440802a8809f38a5ae903ce" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d001" target="_blank" rel="noopener noreferrer">d001. P-1-1. 合成函數(1)</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b3ee663744080ed8e39e622b26e8d0d"><li>Version 1</li><ul class="notion-list notion-list-disc notion-block-1b3ee663744080ed8e39e622b26e8d0d"></ul></ul><ul class="notion-list notion-list-disc notion-block-1b3ee66374408089be9dd06d264f635f"><li>Version 2</li><ul class="notion-list notion-list-disc notion-block-1b3ee66374408089be9dd06d264f635f"></ul></ul></div></details><details class="notion-toggle notion-block-1abee6637440809d8c87e34d73cbfae3"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1abee6637440809d8c87e34d73cbfae3" data-id="1abee6637440809d8c87e34d73cbfae3"><span><div id="1abee6637440809d8c87e34d73cbfae3" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d002" target="_blank" rel="noopener noreferrer">d002. Q-1-2. 合成函數(2)</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b4ee663744080b09a1bee8f333329db"><li>Version 1</li><ul class="notion-list notion-list-disc notion-block-1b4ee663744080b09a1bee8f333329db"></ul></ul><ul class="notion-list notion-list-disc notion-block-1b4ee66374408013a380fd5698b8966f"><li>Version 2</li><ul class="notion-list notion-list-disc notion-block-1b4ee66374408013a380fd5698b8966f"></ul></ul></div></details><details class="notion-toggle notion-block-1abee663744080b0ad6ee11f1c2371e5"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1abee663744080b0ad6ee11f1c2371e5" data-id="1abee663744080b0ad6ee11f1c2371e5"><span><div id="1abee663744080b0ad6ee11f1c2371e5" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d003" target="_blank" rel="noopener noreferrer">d003. P-1-3. 棍子中點切割</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1abee6637440808dba24e134cc0a99ab"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1abee6637440808dba24e134cc0a99ab" data-id="1abee6637440808dba24e134cc0a99ab"><span><div id="1abee6637440808dba24e134cc0a99ab" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d004" target="_blank" rel="noopener noreferrer">d004. Q-1-4. 支點切割</a></span></span></h3></summary><div><details class="notion-toggle notion-block-1abee6637440804b9b1cc41884401aa3"><summary>關於兩次前後綴和的詳解</summary><div><h4 class="notion-h notion-h3 notion-block-1aeee663744080988b3ce4bc1987372f" data-id="1aeee663744080988b3ce4bc1987372f"><span><div id="1aeee663744080988b3ce4bc1987372f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee663744080988b3ce4bc1987372f" title="為什麼求兩次前後綴和就能找到最佳切點？"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>為什麼求兩次前後綴和就能找到最佳切點？</b></span></span></h4><hr class="notion-hr notion-block-1aeee66374408069875bc0ad3c61c73d"/><div class="notion-text notion-block-1aeee663744080449219f49ba0185a13">這個問題的核心在於如何高效地計算數列的「加權和不平衡度」，並找到使這個值最小的切割點。讓我們來一步步拆解這個過程。</div><hr class="notion-hr notion-block-1aeee663744080d88870f4235cc78934"/><h4 class="notion-h notion-h3 notion-block-1aeee66374408007ab7df6a28c1b353c" data-id="1aeee66374408007ab7df6a28c1b353c"><span><div id="1aeee66374408007ab7df6a28c1b353c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee66374408007ab7df6a28c1b353c" title="1. 問題目標"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>1. 問題目標</b></span></span></h4><div class="notion-text notion-block-1aeee6637440802a8748e494c7fbe990">給定一個數列 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，我們想找到一個最佳切割點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，使得 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的值 <b>最小</b>。</div><div class="notion-text notion-block-1aeee663744080aebaa9e7e21d917755">這代表的是：</div><ul class="notion-list notion-list-disc notion-block-1aeee6637440801cafe4def9def02977"><li><b>數字 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 的影響力由 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 來衡量</b>：</li><ul class="notion-list notion-list-disc notion-block-1aeee6637440801cafe4def9def02977"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 距離 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 越遠，對總不平衡度影響越大。</li></ul></ul><ul class="notion-list notion-list-disc notion-block-1aeee6637440803ba8b6f0c88a25fbea"><li><b>最佳 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 需要讓左右部分的總影響力盡可能相等</b>。</li></ul><hr class="notion-hr notion-block-1aeee66374408094ba83dbf511ab47ae"/><h4 class="notion-h notion-h3 notion-block-1aeee663744080aaa7ebfe9a9ab0e900" data-id="1aeee663744080aaa7ebfe9a9ab0e900"><span><div id="1aeee663744080aaa7ebfe9a9ab0e900" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee663744080aaa7ebfe9a9ab0e900" title="2. 直接計算的問題"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>2. 直接計算的問題</b></span></span></h4><div class="notion-text notion-block-1aeee6637440807c9c65c32df0524735">如果直接暴力計算：</div><ul class="notion-list notion-list-disc notion-block-1aeee66374408013b190f63938aee9da"><li><b>對於每個 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b>（候選切點）</b>，我們需要計算 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee6637440803e865fef36af5bb283"><li><b>這樣的計算是 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 的</b>。</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee66374408075876cf4d529ad68ed"><li><b>如果要對所有可能的 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 都計算一遍，時間複雜度會是 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，這對於 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 來說太耗時。</li></ul><hr class="notion-hr notion-block-1aeee663744080aebeffc1baed6286e5"/><h4 class="notion-h notion-h3 notion-block-1aeee6637440805189b6f0b382a6c663" data-id="1aeee6637440805189b6f0b382a6c663"><span><div id="1aeee6637440805189b6f0b382a6c663" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee6637440805189b6f0b382a6c663" title="3. 透過前後綴和來快速計算"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>3. 透過前後綴和來快速計算</b></span></span></h4><div class="notion-text notion-block-1aeee6637440808c970bebe1059f73d7">為了加速這個計算，我們預處理兩組前綴和：</div><ul class="notion-list notion-list-disc notion-block-1aeee663744080c7b3a9de2ebd5055db"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：區間 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的總和</li><ul class="notion-list notion-list-disc notion-block-1aeee663744080c7b3a9de2ebd5055db"><div class="notion-text notion-block-1aeee663744080569f3ce080ddf939e5"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></ul></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080638aebc38aa59480de"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：區間 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的總和</li><ul class="notion-list notion-list-disc notion-block-1aeee663744080638aebc38aa59480de"><div class="notion-text notion-block-1aeee663744080f59b53c14303bde85f"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div></ul></ul><div class="notion-text notion-block-1aeee6637440807ebfdffec856be1093">接著，我們定義”前綴加權和”和”後綴加權和”：</div><ul class="notion-list notion-list-disc notion-block-1aeee663744080bb88c5d04a05106f8e"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080a29d88dfdc9417b67d"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><div class="notion-text notion-block-1aeee663744080d29141dd109c79b522">這兩個陣列的核心作用是 <b>快速計算每個 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 的不平衡度</b>：</div><div class="notion-text notion-block-1aeee663744080eda25cfbc65f6ea32e"><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></div><div class="notion-text notion-block-1aeee663744080288777da1a9c75296d">其中：</div><ul class="notion-list notion-list-disc notion-block-1aeee663744080ab9ac4cc010632c970"><li>左側不平衡度： <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee6637440803e8082ff54e14b6dd5"><li>右側不平衡度： <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><div class="notion-text notion-block-1aeee663744080108f8fd5adff491640">這樣，我們只要遍歷 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> <b>一次</b>（ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ），就能快速計算所有 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的不平衡度，從而找到最佳切割點。</div><hr class="notion-hr notion-block-1aeee6637440803c99f5e78e553b737d"/><h4 class="notion-h notion-h3 notion-block-1aeee663744080aea764f2ddfbb278ca" data-id="1aeee663744080aea764f2ddfbb278ca"><span><div id="1aeee663744080aea764f2ddfbb278ca" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee663744080aea764f2ddfbb278ca" title="4. 具體計算流程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>4. 具體計算流程</b></span></span></h4><div class="notion-text notion-block-1aeee663744080258c72fad94c3dd299">假設我們有數列：</div><ol start="1" class="notion-list notion-list-numbered notion-block-1aeee66374408058b159cf55dfc59ec7" style="list-style-type:decimal"><li><b>計算 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 和 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> </b></li><ol class="notion-list notion-list-numbered notion-block-1aeee66374408058b159cf55dfc59ec7" style="list-style-type:lower-alpha"></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1aeee6637440803a9284c9937cf47f25" style="list-style-type:decimal"><li><b>計算 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 和 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li><ol class="notion-list notion-list-numbered notion-block-1aeee6637440803a9284c9937cf47f25" style="list-style-type:lower-alpha"></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1aeee663744080919e47e560402e1d53" style="list-style-type:decimal"><li><b>尋找最佳切割點</b></li><ol class="notion-list notion-list-numbered notion-block-1aeee663744080919e47e560402e1d53" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1aeee663744080a38d77ed24df16ba57"><li><b>對每個 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b>，計算 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080a38140cd5ed4b95064"><li>找到 <b>最小的</b> 組合，即為最佳切割點。</li></ul></ol></ol><hr class="notion-hr notion-block-1aeee6637440807485d9fe4f63e74165"/><h4 class="notion-h notion-h3 notion-block-1aeee663744080b788cbd4f26edaadce" data-id="1aeee663744080b788cbd4f26edaadce"><span><div id="1aeee663744080b788cbd4f26edaadce" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee663744080b788cbd4f26edaadce" title="5. 為什麼這樣做可以找出最佳切點？"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>5. 為什麼這樣做可以找出最佳切點？</b></span></span></h4><div class="notion-text notion-block-1aeee663744080b38628c5e28443ec79">透過 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 和 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：</div><ul class="notion-list notion-list-disc notion-block-1aeee66374408017824ddbdad8a9506d"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> <b>代表 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 左側區間的影響力</b>。</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee6637440807ebc2bd82780399fcb"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> <b>代表 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 右側區間的影響力</b>。</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080a3a013fb3330a38abd"><li><b>當這兩個值相近時，左右影響力相等，切割點最平衡！</b></li></ul><div class="notion-text notion-block-1aeee663744080e28161f979fcd0ee20">我們只需要一次遍歷（ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ）就能高效計算所有 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的影響力，從而找出最佳切割點，避免暴力計算的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 時間複雜度。</div><hr class="notion-hr notion-block-1aeee6637440802bbaf7e0abb3c5952f"/><h4 class="notion-h notion-h3 notion-block-1aeee66374408097b0d1d4d1c9d70d9b" data-id="1aeee66374408097b0d1d4d1c9d70d9b"><span><div id="1aeee66374408097b0d1d4d1c9d70d9b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee66374408097b0d1d4d1c9d70d9b" title="6. 時間複雜度"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>6. 時間複雜度</b></span></span></h4><ul class="notion-list notion-list-disc notion-block-1aeee663744080fca92dc17e462b1a0e"><li><b>計算前綴和 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee6637440802a8721fa3ce708320d"><li><b>計算前綴加權和 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>：<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080839e2eec56cd1de3e0"><li><b>尋找最佳切割點</b>：<span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee66374408005ba78ef604e9035c5"><li><b>總共 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 時間內完成切割點的搜尋</b>，比原本 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 快。</li></ul></div></details></div></details><details class="notion-toggle notion-block-1adee663744080c88696c026ea4e8bd7"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1adee663744080c88696c026ea4e8bd7" data-id="1adee663744080c88696c026ea4e8bd7"><span><div id="1adee663744080c88696c026ea4e8bd7" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d005" target="_blank" rel="noopener noreferrer">d005. Q-1-5. 二維黑白影像編碼</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1adee66374408077a4e7ccf54aa17704"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1adee66374408077a4e7ccf54aa17704" data-id="1adee66374408077a4e7ccf54aa17704"><span><div id="1adee66374408077a4e7ccf54aa17704" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d006" target="_blank" rel="noopener noreferrer">d006. P-1-7. 子集合乘積</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1adee6637440807b9de4deb4383cbbd0"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1adee6637440807b9de4deb4383cbbd0" data-id="1adee6637440807b9de4deb4383cbbd0"><span><div id="1adee6637440807b9de4deb4383cbbd0" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d007" target="_blank" rel="noopener noreferrer">d007. Q-1-8. 子集合的和</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee66374408071ba93c2b2524b92d8"><li>backtracking 窮舉</li></ul></div></details><details class="notion-toggle notion-block-1adee66374408031986cc80325236f04"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1adee66374408031986cc80325236f04" data-id="1adee66374408031986cc80325236f04"><span><div id="1adee66374408031986cc80325236f04" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d008" target="_blank" rel="noopener noreferrer">d008. Q-1-10. 最多得分的皇后</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee6637440804db353fc9b2d93d1c8"><li>就是 N Queen(?</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080bfa84cd240bf114ec7"><li>使用一個 vector 來記錄之前每個 row 放置的皇后 col，讓斜向判斷比較好寫</li></ul></div></details><details class="notion-toggle notion-block-1adee6637440809f983afd5d2998299f"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1adee6637440809f983afd5d2998299f" data-id="1adee6637440809f983afd5d2998299f"><span><div id="1adee6637440809f983afd5d2998299f" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d009" target="_blank" rel="noopener noreferrer">d009. Q-1-11. 刪除矩形邊界</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee663744080d2acfbf009a271271f"><li>模擬</li></ul></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1aeee663744080749c27f648696b7bd5" data-id="1aeee663744080749c27f648696b7bd5"><span><div id="1aeee663744080749c27f648696b7bd5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1aeee663744080749c27f648696b7bd5" title="Ch02. Sort &amp; Binary Search"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ch02. Sort &amp; Binary Search</span></span></h2><details class="notion-toggle notion-block-1aeee6637440808b96b9ef62130715f1"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee6637440808b96b9ef62130715f1" data-id="1aeee6637440808b96b9ef62130715f1"><span><div id="1aeee6637440808b96b9ef62130715f1" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d010" target="_blank" rel="noopener noreferrer">d010. P-2-1. 不同的數</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1aeee663744080dfac66dde2e23e4c24"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080dfac66dde2e23e4c24" data-id="1aeee663744080dfac66dde2e23e4c24"><span><div id="1aeee663744080dfac66dde2e23e4c24" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d011" target="_blank" rel="noopener noreferrer">d011. P-2-2. 離散化</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1aeee663744080cfa870ce292f3255bb"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080cfa870ce292f3255bb" data-id="1aeee663744080cfa870ce292f3255bb"><span><div id="1aeee663744080cfa870ce292f3255bb" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d012" target="_blank" rel="noopener noreferrer">d012. P-2-3. 快速冪</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1aeee66374408054b7aae792bf54db89"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee66374408054b7aae792bf54db89" data-id="1aeee66374408054b7aae792bf54db89"><span><div id="1aeee66374408054b7aae792bf54db89" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d013" target="_blank" rel="noopener noreferrer">d013. Q-2-4. 快速冪 2</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee6637440803d93cdc0fc32473b23"><li>超大數 ⇒ string</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee66374408033b270f7f9ddd7fae2"><li>將大數切開，一位一位處理，再用10的冪次乘上去，不斷取模才不會 overflow</li></ul></div></details><details class="notion-toggle notion-block-1aeee66374408005ad52f5253616f875"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee66374408005ad52f5253616f875" data-id="1aeee66374408005ad52f5253616f875"><span><div id="1aeee66374408005ad52f5253616f875" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d014" target="_blank" rel="noopener noreferrer">d014. Q-2-5. 快速計算費式數列第 n 項</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee66374408027ab78d01eefd31343"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> </li></ul><ul class="notion-list notion-list-disc notion-block-1aeee66374408057a83cee909f0901c8"><li>對上述矩陣做快速冪，最後左上角的元素即為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1aeee663744080c69093f984de00de20"><li>扁平化成一維 vector 比較好寫</li></ul></div></details><details class="notion-toggle notion-block-1aeee663744080cfaa0eeef528872094"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080cfaa0eeef528872094" data-id="1aeee663744080cfaa0eeef528872094"><span><div id="1aeee663744080cfaa0eeef528872094" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d015" target="_blank" rel="noopener noreferrer">d015. P-2-6. Two-Number problem</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1aeee663744080418b9dfd2987525a46"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080418b9dfd2987525a46" data-id="1aeee663744080418b9dfd2987525a46"><span><div id="1aeee663744080418b9dfd2987525a46" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d016" target="_blank" rel="noopener noreferrer">d016. Q-2-7. 互補團隊</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee663744080e487f1caf6371d4dff"><li>用 bitmask 去重</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee66374408050ad2cfd470c0a0162"><li>如果用 XOR 還是需要 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> ，會吃 TLE</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee66374408056b954e04bb14be627"><li>直接排序後往後做二分搜，複雜度是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-1aeee66374408098b59ac803db96e1da"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee66374408098b59ac803db96e1da" data-id="1aeee66374408098b59ac803db96e1da"><span><div id="1aeee66374408098b59ac803db96e1da" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d017" target="_blank" rel="noopener noreferrer">d017. Q-2-8. 模逆元</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee6637440803db2c1fa9218e50657"><li>費馬小定理: 當模數 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為質數時，任意非 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 倍數的整數 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的模逆元為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-1aeee663744080c88fbae6e390b4c1dd"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080c88fbae6e390b4c1dd" data-id="1aeee663744080c88fbae6e390b4c1dd"><span><div id="1aeee663744080c88fbae6e390b4c1dd" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d018" target="_blank" rel="noopener noreferrer">d018. P-2-9. 子集合乘積</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee6637440801f9c33c12a037b409d"><li>直接窮舉 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 鐵吃 TLE</li></ul><ul class="notion-list notion-list-disc notion-block-1aeee66374408088822bff3b2b639e6e"><li>折半枚舉，往另外一個集合搜模逆元，將複雜度降到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-1aeee663744080c4a665d53a09290841"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080c4a665d53a09290841" data-id="1aeee663744080c4a665d53a09290841"><span><div id="1aeee663744080c4a665d53a09290841" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d019" target="_blank" rel="noopener noreferrer">d019. Q-2-10. 子集合的和</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1aeee663744080bd8838d8c1946875e0"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080bd8838d8c1946875e0" data-id="1aeee663744080bd8838d8c1946875e0"><span><div id="1aeee663744080bd8838d8c1946875e0" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d020" target="_blank" rel="noopener noreferrer">d020. P-2-11. 最接近的區間和</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1aeee663744080ee9512f36fe71fc4bc"><li>維護前綴和集合，在其中搜尋最接近 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的結果</li></ul></div></details><details class="notion-toggle notion-block-1aeee6637440806c8ea7eb8fc326bff6"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee6637440806c8ea7eb8fc326bff6" data-id="1aeee6637440806c8ea7eb8fc326bff6"><span><div id="1aeee6637440806c8ea7eb8fc326bff6" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d021" target="_blank" rel="noopener noreferrer">d021. Q-2-12. 最接近的子矩陣和</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1afee663744080bf81c9fb82e86cbccb"><li>對矩陣的行列求前綴和，扁平化成一維陣列，轉換成 d20 求解。</li></ul></div></details><details class="notion-toggle notion-block-1aeee663744080b48e7bfd0d9d59adcc"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1aeee663744080b48e7bfd0d9d59adcc" data-id="1aeee663744080b48e7bfd0d9d59adcc"><span><div id="1aeee663744080b48e7bfd0d9d59adcc" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d022" target="_blank" rel="noopener noreferrer">d022. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d022" target="_blank" rel="noopener noreferrer">Q-2-13. 無理數的快速冪</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1afee663744080269b33f3945859f1d3"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1afee66374408040a56de6df1304aa73"><li>有理數部分: <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1afee663744080e29aaed983faea9762"><li>無理數部分: <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1afee663744080039e15d09beb5a9c65"><li>剩下的就是快速冪</li></ul></div></details><details class="notion-toggle notion-block-1afee6637440806a98eac316308bdfe9"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1afee6637440806a98eac316308bdfe9" data-id="1afee6637440806a98eac316308bdfe9"><span><div id="1afee6637440806a98eac316308bdfe9" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d023" target="_blank" rel="noopener noreferrer">d023. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d023" target="_blank" rel="noopener noreferrer">Q-2-14. 水槽</a></b></span></span></h3></summary><div><details class="notion-toggle notion-block-1afee663744080bfb0d3c56ab2b24fde"><summary>官方教材提示</summary><div><ul class="notion-list notion-list-disc notion-block-1afee66374408099999ef4fda7c612d6"><li>如果區間只剩一個水槽，該水槽高度=水量，結束</li></ul><ul class="notion-list notion-list-disc notion-block-1afee66374408090bb51cd9aa0db298e"><li>否則，在區間中找出最高的隔板，假設此隔板高度為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。區間被此隔板分成左右兩邊，考慮下面三種情形：</li><ul class="notion-list notion-list-disc notion-block-1afee66374408090bb51cd9aa0db298e"><ol start="1" class="notion-list notion-list-numbered notion-block-1afee663744080f6b356f0851fc56563" style="list-style-type:decimal"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，水量足以讓兩邊都至少 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，區間內所有水槽高度皆是相同的平均值，結束。</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1afee6637440801d84e8f2e888016ee4" style="list-style-type:decimal"><li>水量不足以越過輸入這一邊，那麼，另外一邊一定不會有水，縮小區間遞迴呼叫。</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1afee66374408093bf08ca82ee144203" style="list-style-type:decimal"><li>水量會越過輸入這一邊，那麼，輸入這一邊的水槽高度一定都是 H，把水量扣掉後遞迴呼叫另外一邊。</li></ol></ul></ul></div></details><ul class="notion-list notion-list-disc notion-block-1afee663744080668cb5c55580ec4e57"><li>跟著提示遞迴下去就對了</li></ul></div></details><details class="notion-toggle notion-block-1b0ee663744080c4b26fca4ba0af56b4"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b0ee663744080c4b26fca4ba0af56b4" data-id="1b0ee663744080c4b26fca4ba0af56b4"><span><div id="1b0ee663744080c4b26fca4ba0af56b4" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d024" target="_blank" rel="noopener noreferrer">d024. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d024" target="_blank" rel="noopener noreferrer">P-2-15. 圓環出口</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b0ee66374408001842dee12ec5b1b56"><li>將整個陣列複製一份拼在後面 ⇒ 維護前綴和 ⇒ 往後二分搜</li></ul></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1afee6637440803baf2cde8ec66e1916" data-id="1afee6637440803baf2cde8ec66e1916"><span><div id="1afee6637440803baf2cde8ec66e1916" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1afee6637440803baf2cde8ec66e1916" title="Ch03. Queue &amp; Stack"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ch03. Queue &amp; Stack</span></span></h2><details class="notion-toggle notion-block-1afee663744080e7a112d651db1641d6"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1afee663744080e7a112d651db1641d6" data-id="1afee663744080e7a112d651db1641d6"><span><div id="1afee663744080e7a112d651db1641d6" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d025" target="_blank" rel="noopener noreferrer">d025. P-3-1. 樹的高度與根</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b0ee66374408082b0ede774121af5ca"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b0ee66374408082b0ede774121af5ca" data-id="1b0ee66374408082b0ede774121af5ca"><span><div id="1b0ee66374408082b0ede774121af5ca" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d026" target="_blank" rel="noopener noreferrer">d026. P-3-2. 括弧配對</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b0ee663744080628bc8cd81ad1377ff"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b0ee663744080628bc8cd81ad1377ff" data-id="1b0ee663744080628bc8cd81ad1377ff"><span><div id="1b0ee663744080628bc8cd81ad1377ff" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d027" target="_blank" rel="noopener noreferrer">d027. Q-3-3. 加減乘除</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b0ee663744080eb9537fffd5dcb97dd"><li>Version 1</li><ul class="notion-list notion-list-disc notion-block-1b0ee663744080eb9537fffd5dcb97dd"></ul></ul><ul class="notion-list notion-list-disc notion-block-1b0ee66374408086ae4befbbc7334d1b"><li>Version 2</li><ul class="notion-list notion-list-disc notion-block-1b0ee66374408086ae4befbbc7334d1b"></ul></ul><ul class="notion-list notion-list-disc notion-block-1b0ee66374408010ab17d12dadb9d96c"><li>順便附上 Python 版(?</li><ul class="notion-list notion-list-disc notion-block-1b0ee66374408010ab17d12dadb9d96c"></ul></ul></div></details><details class="notion-toggle notion-block-1b0ee663744080f985eae6a20a7df0b9"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b0ee663744080f985eae6a20a7df0b9" data-id="1b0ee663744080f985eae6a20a7df0b9"><span><div id="1b0ee663744080f985eae6a20a7df0b9" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d028" target="_blank" rel="noopener noreferrer">d028. P-3-4. 最接近的高人</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b0ee663744080cbafc5d3a96a5855d6"><li>Monotonic Stack</li></ul></div></details><details class="notion-toggle notion-block-1b0ee663744080018654c262beeb65f0"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b0ee663744080018654c262beeb65f0" data-id="1b0ee663744080018654c262beeb65f0"><span><div id="1b0ee663744080018654c262beeb65f0" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d029" target="_blank" rel="noopener noreferrer">d029. Q-3-5. 帶著板凳排雞排的高人</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b2ee663744080cdadb7df54b05a745e"><li>用 vector 維護 monotonic sequence，因為單調性可以直接二分搜</li></ul></div></details><details class="notion-toggle notion-block-1b2ee663744080f98e46c7805b46f43f"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b2ee663744080f98e46c7805b46f43f" data-id="1b2ee663744080f98e46c7805b46f43f"><span><div id="1b2ee663744080f98e46c7805b46f43f" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d030" target="_blank" rel="noopener noreferrer">d030. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d030" target="_blank" rel="noopener noreferrer">P-3-6. 砍樹</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b2ee6637440809584fde5cf22a0215e"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b2ee6637440809584fde5cf22a0215e" data-id="1b2ee6637440809584fde5cf22a0215e"><span><div id="1b2ee6637440809584fde5cf22a0215e" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d031" target="_blank" rel="noopener noreferrer">d031. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d031" target="_blank" rel="noopener noreferrer">P-3-7. 正整數序列之最接近的區間和</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b2ee663744080b09812fc48c086aaf7"><li>Sliding Window</li></ul></div></details><details class="notion-toggle notion-block-1b2ee663744080fcbbf2d7445b385854"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b2ee663744080fcbbf2d7445b385854" data-id="1b2ee663744080fcbbf2d7445b385854"><span><div id="1b2ee663744080fcbbf2d7445b385854" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d032" target="_blank" rel="noopener noreferrer">d032. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d032" target="_blank" rel="noopener noreferrer">P-3-8. 固定長度區間的最大區段差</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b2ee663744080fab152d808bc39dfc8"><li>Monotonic Queue</li></ul></div></details><details class="notion-toggle notion-block-1b2ee66374408070bf51ee6a78b17429"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b2ee66374408070bf51ee6a78b17429" data-id="1b2ee66374408070bf51ee6a78b17429"><span><div id="1b2ee66374408070bf51ee6a78b17429" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d033" target="_blank" rel="noopener noreferrer">d033. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d033" target="_blank" rel="noopener noreferrer">P-3-9. 最多色彩帶</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b2ee663744080d1b383dec97d7feda4"><li>針對整個區間做計數太浪費時間，只在 element 進入與離開 window 時做計數更新與判斷</li></ul></div></details><details class="notion-toggle notion-block-1b2ee66374408076b18afb7df3fd26fc"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b2ee66374408076b18afb7df3fd26fc" data-id="1b2ee66374408076b18afb7df3fd26fc"><span><div id="1b2ee66374408076b18afb7df3fd26fc" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d034" target="_blank" rel="noopener noreferrer">d034. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d034" target="_blank" rel="noopener noreferrer">P-3-10. 全彩彩帶</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b3ee66374408076aa34e30309019003"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b3ee66374408076aa34e30309019003" data-id="1b3ee66374408076aa34e30309019003"><span><div id="1b3ee66374408076aa34e30309019003" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d035" target="_blank" rel="noopener noreferrer">d035. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d035" target="_blank" rel="noopener noreferrer">Q-3-11. 最長的相異色彩帶</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b3ee663744080fdb4c0d93040b6b804"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b3ee663744080fdb4c0d93040b6b804" data-id="1b3ee663744080fdb4c0d93040b6b804"><span><div id="1b3ee663744080fdb4c0d93040b6b804" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d036" target="_blank" rel="noopener noreferrer">d036. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d036" target="_blank" rel="noopener noreferrer">Q-3-12. 完美彩帶</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b3ee66374408084ab87f9ea4b2423bf"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b3ee66374408084ab87f9ea4b2423bf" data-id="1b3ee66374408084ab87f9ea4b2423bf"><span><div id="1b3ee66374408084ab87f9ea4b2423bf" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d037" target="_blank" rel="noopener noreferrer">d037. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d037" target="_blank" rel="noopener noreferrer">Q-3-13. X差值範圍內的最大Y差值</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b3ee663744080f68e0bfadfa0384983"><li>排序後將距離已經超出的點從比較的範圍中移除</li></ul></div></details><details class="notion-toggle notion-block-1b3ee6637440805d8691f82bb7578bc4"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b3ee6637440805d8691f82bb7578bc4" data-id="1b3ee6637440805d8691f82bb7578bc4"><span><div id="1b3ee6637440805d8691f82bb7578bc4" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d038" target="_blank" rel="noopener noreferrer">d038. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d038" target="_blank" rel="noopener noreferrer">Q-3-14. 線性函數</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b4ee663744080f1a4d6f0c6c691c438"><li>凸包優化，保持單調性</li></ul><ul class="notion-list notion-list-disc notion-block-1b4ee66374408040931aee601771af11"><li>二分搜</li></ul><details class="notion-toggle notion-block-1b4ee6637440803f817de6f21a03f331"><summary>詳解看這邊</summary><div><h3 class="notion-h notion-h2 notion-block-1b4ee663744080958eb3f89a7d0228a1" data-id="1b4ee663744080958eb3f89a7d0228a1"><span><div id="1b4ee663744080958eb3f89a7d0228a1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b4ee663744080958eb3f89a7d0228a1" title="程式碼詳解"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>程式碼詳解</b></span></span></h3><h4 class="notion-h notion-h3 notion-block-1b4ee6637440800ca989d444f3fc7c3b" data-id="1b4ee6637440800ca989d444f3fc7c3b"><span><div id="1b4ee6637440800ca989d444f3fc7c3b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b4ee6637440800ca989d444f3fc7c3b" title="步驟 1：輸入 &amp; 排序"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>步驟 1：輸入 &amp; 排序</b></span></span></h4><ul class="notion-list notion-list-disc notion-block-1b4ee66374408055a580ea17478021c9"><li>依據 <b>斜率 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><b> 遞增排序</b>，若 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 相同則依據截距 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 遞增排序。</li></ul><ul class="notion-list notion-list-disc notion-block-1b4ee663744080e6b4fef48a58e649df"><li>這樣能確保同一斜率時<b>只保留截距較大的直線</b>，其他的直線永遠無法成為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的最大值，因為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。</li></ul><hr class="notion-hr notion-block-1b4ee663744080eb89b1f711c5603fca"/><h4 class="notion-h notion-h3 notion-block-1b4ee6637440802d940af11a2662b6e4" data-id="1b4ee6637440802d940af11a2662b6e4"><span><div id="1b4ee6637440802d940af11a2662b6e4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b4ee6637440802d940af11a2662b6e4" title="步驟 2：建構上凸包"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>步驟 2：建構上凸包</b></span></span></h4><ol start="1" class="notion-list notion-list-numbered notion-block-1b4ee6637440806ea079ecede943f0a1" style="list-style-type:decimal"><li><b>去除冗餘直線</b></li><ol class="notion-list notion-list-numbered notion-block-1b4ee6637440806ea079ecede943f0a1" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1b4ee6637440805283e2cf833e91c03e"><li>如果新的直線<b>斜率與最後一條直線相同</b>，則刪除舊的（因為它的截距 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 更小）。</li></ul></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1b4ee6637440808aac76e3c3ecd86d5d" style="list-style-type:decimal"><li><b>維護凸包</b></li><ol class="notion-list notion-list-numbered notion-block-1b4ee6637440808aac76e3c3ecd86d5d" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1b4ee6637440801fbfdec131c25bd79f"><li>若新加入的直線與當前最後一條直線的交點<b>不單調遞增</b>，則刪除最後一條直線，直到恢復單調性。</li></ul></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-1b4ee663744080cb81c2ef68137d51aa" style="list-style-type:decimal"><li><b>儲存交點</b></li><ol class="notion-list notion-list-numbered notion-block-1b4ee663744080cb81c2ef68137d51aa" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1b4ee663744080588b3bccd042b340b5"><li>每當有新的直線加入，計算與前一條直線的交點 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，並存入 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。</li></ul></ol></ol><hr class="notion-hr notion-block-1b4ee66374408077a192e91589602227"/><h4 class="notion-h notion-h3 notion-block-1b4ee663744080b08d52e73e67f02bb8" data-id="1b4ee663744080b08d52e73e67f02bb8"><span><div id="1b4ee663744080b08d52e73e67f02bb8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b4ee663744080b08d52e73e67f02bb8" title="步驟 3：快速查詢 "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>步驟 3：快速查詢 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></span></span></h4><ol start="1" class="notion-list notion-list-numbered notion-block-1b4ee663744080fd9288e507859d5792" style="list-style-type:decimal"><li><b>二分搜尋</b></li><ol class="notion-list notion-list-numbered notion-block-1b4ee663744080fd9288e507859d5792" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1b4ee663744080ba8ae8d7ecc6d70480"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul><ul class="notion-list notion-list-disc notion-block-1b4ee66374408085bb2ef9603ae35c03"><li>找到 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 對應的區間，確保我們選擇的 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 是 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的最大值。</li></ul></ol></ol><ol start="2" class="notion-list notion-list-numbered notion-block-1b4ee6637440803fa9b2ebee82144099" style="list-style-type:decimal"><li><b>計算 </b><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li><ol class="notion-list notion-list-numbered notion-block-1b4ee6637440803fa9b2ebee82144099" style="list-style-type:lower-alpha"><ul class="notion-list notion-list-disc notion-block-1b4ee66374408078a4d0f78369031788"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，累加進 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>。</li></ul></ol></ol></div></details></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1b4ee6637440805a9987c0cdb66966ce" data-id="1b4ee6637440805a9987c0cdb66966ce"><span><div id="1b4ee6637440805a9987c0cdb66966ce" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b4ee6637440805a9987c0cdb66966ce" title="Ch04. Greedy &amp; Line Sweeping"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ch04. Greedy &amp; Line Sweeping</span></span></h2><details class="notion-toggle notion-block-1b4ee6637440800896dac912975252cd"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b4ee6637440800896dac912975252cd" data-id="1b4ee6637440800896dac912975252cd"><span><div id="1b4ee6637440800896dac912975252cd" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d042" target="_blank" rel="noopener noreferrer">d042. P-4-1. 少林寺的代幣</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b4ee663744080f5b1d9e38e4d8555a1"><li>大硬幣可以換成小硬幣 ⇒ 不存在小硬幣可以支付而大硬幣不能支付的情況</li></ul><ul class="notion-list notion-list-disc notion-block-1b4ee66374408021a265cab0a5fae245"><li>選大硬幣與小硬幣都可以的情況下，選大硬幣的數量更少</li></ul></div></details><details class="notion-toggle notion-block-1b4ee66374408072a07ed0e04162763d"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b4ee66374408072a07ed0e04162763d" data-id="1b4ee66374408072a07ed0e04162763d"><span><div id="1b4ee66374408072a07ed0e04162763d" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d043" target="_blank" rel="noopener noreferrer">d043. P-4-2. 笑傲江湖之三戰</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b4ee6637440808b8197cd47c5b18e28"><li>只挑最方戰力最低的挑戰</li></ul></div></details><details class="notion-toggle notion-block-1b4ee663744080ba93c3f31f66e7e2f2"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b4ee663744080ba93c3f31f66e7e2f2" data-id="1b4ee663744080ba93c3f31f66e7e2f2"><span><div id="1b4ee663744080ba93c3f31f66e7e2f2" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d044" target="_blank" rel="noopener noreferrer">d044. P-4-3. 十年磨一劍</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b4ee6637440805bae6bc8e9e56a8166"><li>idx 越小，權重越大(會被乘到更多次) ⇒ 從小到大排序</li></ul><ul class="notion-list notion-list-disc notion-block-1b4ee66374408087a76efb7d7ffb5d0f"><li>要用 Long Long 才不會 overflow</li></ul></div></details><details class="notion-toggle notion-block-1b4ee6637440802ab7e3de5730cf9d5c"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b4ee6637440802ab7e3de5730cf9d5c" data-id="1b4ee6637440802ab7e3de5730cf9d5c"><span><div id="1b4ee6637440802ab7e3de5730cf9d5c" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d045" target="_blank" rel="noopener noreferrer">d045. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d045" target="_blank" rel="noopener noreferrer">P-4-4. 幾場華山論劍</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b4ee6637440802dbfdbe21553a335f0"><li>Earliest Deadline First</li></ul></div></details><details class="notion-toggle notion-block-1b4ee66374408044add2ccd7f5d0f958"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b4ee66374408044add2ccd7f5d0f958" data-id="1b4ee66374408044add2ccd7f5d0f958"><span><div id="1b4ee66374408044add2ccd7f5d0f958" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d046" target="_blank" rel="noopener noreferrer">d046. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d046" target="_blank" rel="noopener noreferrer">P-4-5. 嵩山磨劍坊的問題</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee663744080b0864fc4a32c2867d5"><li>按照 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 從小到大排序</li></ul></div></details><details class="notion-toggle notion-block-1b5ee663744080598698d06bede14ecf"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee663744080598698d06bede14ecf" data-id="1b5ee663744080598698d06bede14ecf"><span><div id="1b5ee663744080598698d06bede14ecf" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d047" target="_blank" rel="noopener noreferrer">d047. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d047" target="_blank" rel="noopener noreferrer">Q-4-6. 少林寺的自動寄物櫃</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee6637440805faba6e96acdadf2e6"><li>這題用 double 算比值會 overflow，改用交叉相乘比大小的方式排序</li></ul></div></details><details class="notion-toggle notion-block-1b5ee663744080b3931efbec7fbe1ac4"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee663744080b3931efbec7fbe1ac4" data-id="1b5ee663744080b3931efbec7fbe1ac4"><span><div id="1b5ee663744080b3931efbec7fbe1ac4" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d048" target="_blank" rel="noopener noreferrer">d048. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d048" target="_blank" rel="noopener noreferrer">P-4-7. 岳不群的併派問題</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee663744080cc996fc74cfc18472b"><li>越早合併的數字會被算到越多次 ⇒ 小的先合併</li></ul></div></details><details class="notion-toggle notion-block-1b5ee663744080078618f96051618047"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee663744080078618f96051618047" data-id="1b5ee663744080078618f96051618047"><span><div id="1b5ee663744080078618f96051618047" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d053" target="_blank" rel="noopener noreferrer">d053. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d053" target="_blank" rel="noopener noreferrer">Q-4-8. 先到先服務</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee6637440802c96a7cf36b481c2ea"><li>用 pq 的大小模擬櫃台的數量</li></ul></div></details><details class="notion-toggle notion-block-1b5ee663744080a5a70bce44d2f06779"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee663744080a5a70bce44d2f06779" data-id="1b5ee663744080a5a70bce44d2f06779"><span><div id="1b5ee663744080a5a70bce44d2f06779" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d049" target="_blank" rel="noopener noreferrer">d049. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d049" target="_blank" rel="noopener noreferrer">P-4-9. 基地台</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee66374408050a671e372679925b0"><li>二分搜</li></ul></div></details><details class="notion-toggle notion-block-1b5ee663744080f097d6f0d50dd051b8"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee663744080f097d6f0d50dd051b8" data-id="1b5ee663744080f097d6f0d50dd051b8"><span><div id="1b5ee663744080f097d6f0d50dd051b8" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d054" target="_blank" rel="noopener noreferrer">d054. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d054" target="_blank" rel="noopener noreferrer">Q-4-10. 恢復能量的白雲熊膽丸</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee6637440807c8524f306e0cb8c73"><li>二分搜</li></ul></div></details><details class="notion-toggle notion-block-1b5ee663744080e18183fd63f04a44c1"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee663744080e18183fd63f04a44c1" data-id="1b5ee663744080e18183fd63f04a44c1"><span><div id="1b5ee663744080e18183fd63f04a44c1" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d050" target="_blank" rel="noopener noreferrer">d050. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d050" target="_blank" rel="noopener noreferrer">P-4-11. 線段聯集</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee66374408098bbe9eea53d8c3213"><li>將有重疊的線段合併，確定沒有重疊的線段再計算長度</li></ul></div></details><details class="notion-toggle notion-block-1b5ee663744080cba68de101b666bc8c"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee663744080cba68de101b666bc8c" data-id="1b5ee663744080cba68de101b666bc8c"><span><div id="1b5ee663744080cba68de101b666bc8c" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d051" target="_blank" rel="noopener noreferrer">d051. P-4-12. 一次買賣</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee663744080249491f616e5620636"><li>記錄過去最低的價格，更新最大可以獲得的利益</li></ul></div></details><details class="notion-toggle notion-block-1b5ee6637440807fae30c58785a876e0"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5ee6637440807fae30c58785a876e0" data-id="1b5ee6637440807fae30c58785a876e0"><span><div id="1b5ee6637440807fae30c58785a876e0" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d052" target="_blank" rel="noopener noreferrer">d052. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d052" target="_blank" rel="noopener noreferrer">P-4-13. 最大連續子陣列</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b5ee663744080d283a3ca83466e5c90"><li>保證區間內的總和為正數，否則只會讓後續的總和變小 ⇒ 不如不取</li></ul></div></details><details class="notion-toggle notion-block-1b6ee66374408019815ed490c606e559"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b6ee66374408019815ed490c606e559" data-id="1b6ee66374408019815ed490c606e559"><span><div id="1b6ee66374408019815ed490c606e559" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d055" target="_blank" rel="noopener noreferrer">d055. P-4-14. 控制點</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b6ee6637440805996a4c13bec0248c0"><li>依照 x 座標排序，再對 y 座標維護 monotonic stack</li></ul></div></details><details class="notion-toggle notion-block-1b6ee663744080e4804ed122237eef3d"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b6ee663744080e4804ed122237eef3d" data-id="1b6ee663744080e4804ed122237eef3d"><span><div id="1b6ee663744080e4804ed122237eef3d" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d056" target="_blank" rel="noopener noreferrer">d056. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d056" target="_blank" rel="noopener noreferrer">P-4-15. 最靠近的一對</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b6ee663744080339f8dce78de1f8aca"><li>這題用教材給的作法最後兩個測資會吃 TLE，不知道為啥==</li></ul><ul class="notion-list notion-list-disc notion-block-1b6ee663744080a0a81ee80e34224968"><li>逐漸縮小搜尋的範圍</li></ul></div></details><details class="notion-toggle notion-block-1b6ee66374408087868cceefa6e80213"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b6ee66374408087868cceefa6e80213" data-id="1b6ee66374408087868cceefa6e80213"><span><div id="1b6ee66374408087868cceefa6e80213" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d057" target="_blank" rel="noopener noreferrer">d057. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d057" target="_blank" rel="noopener noreferrer">Q-4-16. 賺錢與罰款</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b6ee66374408035af55fa15c8b4eca5"><li>Shortest Job First</li></ul></div></details><details class="notion-toggle notion-block-1b6ee663744080de8295fb6aa1e99960"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b6ee663744080de8295fb6aa1e99960" data-id="1b6ee663744080de8295fb6aa1e99960"><span><div id="1b6ee663744080de8295fb6aa1e99960" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d058" target="_blank" rel="noopener noreferrer">d058. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d058" target="_blank" rel="noopener noreferrer">Q-4-17. 死線高手</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b6ee6637440800091dced68526647c3"><li>Earliest Deadline First</li></ul><ul class="notion-list notion-list-disc notion-block-1b6ee663744080bea444e49239912d98"><li>小師妹最後還是跟林平之跑了QQ</li></ul></div></details><details class="notion-toggle notion-block-1b6ee6637440805ab7b6e64252b063fb"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b6ee6637440805ab7b6e64252b063fb" data-id="1b6ee6637440805ab7b6e64252b063fb"><span><div id="1b6ee6637440805ab7b6e64252b063fb" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d059" target="_blank" rel="noopener noreferrer">d059. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d059" target="_blank" rel="noopener noreferrer">Q-4-18. 少林寺的櫃姐</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b6ee663744080e8beaac590bf94ed79"><li>d053 加上二分搜</li></ul><ul class="notion-list notion-list-disc notion-block-1b6ee66374408099bac1c78c8263113b"><li>這題要注意的是不要真的創建 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 個櫃台(pq 的大小)，會很久==</li></ul><ul class="notion-list notion-list-disc notion-block-1b6ee66374408086997ad77a7c63af2d"><li>只需要創建 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 個櫃檯就夠了</li></ul></div></details><details class="notion-toggle notion-block-1b6ee663744080eea173dad2310d2a94"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b6ee663744080eea173dad2310d2a94" data-id="1b6ee663744080eea173dad2310d2a94"><span><div id="1b6ee663744080eea173dad2310d2a94" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d060" target="_blank" rel="noopener noreferrer">d060. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d060" target="_blank" rel="noopener noreferrer">Q-4-19. 五嶽盟主的會議場所</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b6ee66374408004ba20c6ebe0750c62"><li>Line Sweeping 問題，筆記可參考<a class="notion-link" href="https://zixu.eu.org/article/%E7%B7%9A%E6%AE%B5%E6%8E%83%E6%8F%8F_%E9%9A%A8%E7%AD%86" target="_blank" rel="noopener noreferrer">這邊</a></li></ul></div></details><details class="notion-toggle notion-block-1b6ee663744080749aeecdee6654e5e8"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b6ee663744080749aeecdee6654e5e8" data-id="1b6ee663744080749aeecdee6654e5e8"><span><div id="1b6ee663744080749aeecdee6654e5e8" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d061" target="_blank" rel="noopener noreferrer">d061. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d061" target="_blank" rel="noopener noreferrer">Q-4-20. 監看華山練功場</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee663744080d7a0e9db52e39d9fb5"><li>不斷更新最遠可以覆蓋到的時間點，每次延長就將計數器加一</li></ul></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1b6ee66374408079b9b2eb7b05e6fc44" data-id="1b6ee66374408079b9b2eb7b05e6fc44"><span><div id="1b6ee66374408079b9b2eb7b05e6fc44" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b6ee66374408079b9b2eb7b05e6fc44" title="Ch05. Divide &amp; Conquer"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ch05. <b>Divide &amp; Conquer</b></span></span></h2><details class="notion-toggle notion-block-1b7ee663744080b49cc3d45be82197b8"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee663744080b49cc3d45be82197b8" data-id="1b7ee663744080b49cc3d45be82197b8"><span><div id="1b7ee663744080b49cc3d45be82197b8" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d064" target="_blank" rel="noopener noreferrer">d064. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d064" target="_blank" rel="noopener noreferrer">P-5-4. 反序數量</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee663744080f7aa44c94a36a3603a"><li>其實就是 Merge Sort</li></ul></div></details><details class="notion-toggle notion-block-1b7ee66374408056aac6d79dc9064fcc"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee66374408056aac6d79dc9064fcc" data-id="1b7ee66374408056aac6d79dc9064fcc"><span><div id="1b7ee66374408056aac6d79dc9064fcc" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d065" target="_blank" rel="noopener noreferrer">d065. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d065" target="_blank" rel="noopener noreferrer">P-5-7. 大樓外牆廣告</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee6637440808e94c9d92cc009f6d0"><li>Merge Version</li><ul class="notion-list notion-list-disc notion-block-1b7ee6637440808e94c9d92cc009f6d0"></ul></ul><ul class="notion-list notion-list-disc notion-block-1b7ee6637440800eb41fd4160531b93e"><li>跑兩次 monotonic stack</li><ul class="notion-list notion-list-disc notion-block-1b7ee6637440800eb41fd4160531b93e"></ul></ul></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1b7ee663744080ee95f6ccffc19b0a57" data-id="1b7ee663744080ee95f6ccffc19b0a57"><span><div id="1b7ee663744080ee95f6ccffc19b0a57" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b7ee663744080ee95f6ccffc19b0a57" title="Ch06. Dynamic Programming"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ch06. Dynamic Programming</span></span></h2><details class="notion-toggle notion-block-1b7ee6637440802bb72ae1041ad98679"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee6637440802bb72ae1041ad98679" data-id="1b7ee6637440802bb72ae1041ad98679"><span><div id="1b7ee6637440802bb72ae1041ad98679" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d066" target="_blank" rel="noopener noreferrer">d066. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d066" target="_blank" rel="noopener noreferrer">P-6-1. 小朋友上樓梯最小成本</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee6637440806e8992e15462fb3b3a"><li>定義 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為從第 0 階踩到第 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 階時，需要耗費的最小成本</li></ul><ul class="notion-list notion-list-disc notion-block-1b7ee663744080f2ac0de65b41028a82"><li>第 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 階只可能來自第 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 階或第 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 階</li></ul><ul class="notion-list notion-list-disc notion-block-1b7ee663744080a981a5c5a0283d38b8"><li>可得出轉移式 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-1b7ee663744080cd9452c7dfca619733"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee663744080cd9452c7dfca619733" data-id="1b7ee663744080cd9452c7dfca619733"><span><div id="1b7ee663744080cd9452c7dfca619733" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d067" target="_blank" rel="noopener noreferrer">d067. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d067" target="_blank" rel="noopener noreferrer">P-6-2. 不連續的表演酬勞</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee663744080e2822beb4c6c9a368b"><li>定義 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為從第 0 天到第 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 天最大的酬勞</li></ul><ul class="notion-list notion-list-disc notion-block-1b7ee663744080b3807ff5557c730700"><li>第 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 天的最大酬勞是<span class="notion-inline-underscore">第 </span><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><span class="notion-inline-underscore"> 天表演</span>或是<span class="notion-inline-underscore">第 </span><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><span class="notion-inline-underscore"> 天和第 </span><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span><span class="notion-inline-underscore"> 天都表演</span></li></ul><ul class="notion-list notion-list-disc notion-block-1b7ee663744080ec92ebff50edbfcca2"><li>可得出轉移式 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-1b7ee6637440807b90acfc36b463f34f"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee6637440807b90acfc36b463f34f" data-id="1b7ee6637440807b90acfc36b463f34f"><span><div id="1b7ee6637440807b90acfc36b463f34f" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d068" target="_blank" rel="noopener noreferrer">d068. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d068" target="_blank" rel="noopener noreferrer">P-6-3. 最小監控鄰居的成本</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee6637440806da83ec8979e9965c5"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 要額外處理</li></ul></div></details><details class="notion-toggle notion-block-1b7ee6637440808cb68bf7bdd2da1c41"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee6637440808cb68bf7bdd2da1c41" data-id="1b7ee6637440808cb68bf7bdd2da1c41"><span><div id="1b7ee6637440808cb68bf7bdd2da1c41" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d072" target="_blank" rel="noopener noreferrer">d072. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d072" target="_blank" rel="noopener noreferrer">Q-6-4. 闖關二選一</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b7ee6637440801d8fa4fdfa70547fa5"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee6637440801d8fa4fdfa70547fa5" data-id="1b7ee6637440801d8fa4fdfa70547fa5"><span><div id="1b7ee6637440801d8fa4fdfa70547fa5" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d073" target="_blank" rel="noopener noreferrer">d073. Q-6-5. 二維最大子矩陣</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee663744080ec9a28d4db2c70549f"><li>跟 d052 類似的作法</li></ul></div></details><details class="notion-toggle notion-block-1b7ee66374408014b7c3e7a4ca53c666"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee66374408014b7c3e7a4ca53c666" data-id="1b7ee66374408014b7c3e7a4ca53c666"><span><div id="1b7ee66374408014b7c3e7a4ca53c666" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d069" target="_blank" rel="noopener noreferrer">d069. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d069" target="_blank" rel="noopener noreferrer">P-6-6. 方格棋盤路線</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee66374408034929cc0a0f428280d"><li>每一格的狀態只能來自<span class="notion-inline-underscore">上方的格子</span>或是<span class="notion-inline-underscore">左邊的格子</span></li></ul></div></details><details class="notion-toggle notion-block-1b7ee663744080a28a23d620d0f33dc4"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee663744080a28a23d620d0f33dc4" data-id="1b7ee663744080a28a23d620d0f33dc4"><span><div id="1b7ee663744080a28a23d620d0f33dc4" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d070" target="_blank" rel="noopener noreferrer">d070. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d070" target="_blank" rel="noopener noreferrer">P-6-7. LCS</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee66374408092bb67f0f20091f23b"><li>經典 LCS</li><ul class="notion-list notion-list-disc notion-block-1b7ee66374408092bb67f0f20091f23b"></ul></ul><ul class="notion-list notion-list-disc notion-block-1bbee66374408080a6d8f5df0dd7b2a6"><li>將 LCS 轉成 LIS 問題，用 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的複雜度求解</li><ul class="notion-list notion-list-disc notion-block-1bbee66374408080a6d8f5df0dd7b2a6"></ul></ul></div></details><details class="notion-toggle notion-block-1b8ee6637440809995b8cecea89fa978"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee6637440809995b8cecea89fa978" data-id="1b8ee6637440809995b8cecea89fa978"><span><div id="1b8ee6637440809995b8cecea89fa978" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d074" target="_blank" rel="noopener noreferrer">d074. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d074" target="_blank" rel="noopener noreferrer">Q-6-8. Local alignment</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee6637440800195ccc85741f40ec4"><li>定義狀態 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 為 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 與 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的最大分數</li></ul><ul class="notion-list notion-list-disc notion-block-1b8ee6637440800396a6de0f34d805d9"><li>如果 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span>，跟 LCS 一樣從前一個狀態轉移過來並加上分數</li></ul><ul class="notion-list notion-list-disc notion-block-1b8ee6637440805f9912cb250e5dc56d"><li>否則: </li><ul class="notion-list notion-list-disc notion-block-1b8ee6637440805f9912cb250e5dc56d"><li>放棄之前的狀態，從 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 開始重新計算(如果是 Global Alignment 就沒有這個情況) ⇒ 0</li><li>選擇讓 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 與 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 不同 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li><li>選擇 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 空白 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li><li>選擇 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 空白 ⇒ <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></ul><ul class="notion-list notion-list-disc notion-block-1b8ee663744080088eb1ccb542641c08"><li>可得出下列轉移式: </li></ul><ul class="notion-list notion-list-disc notion-block-1b8ee663744080f78d60ff059730c8b7"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-1b7ee663744080ed95dffab58a2b8e35"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b7ee663744080ed95dffab58a2b8e35" data-id="1b7ee663744080ed95dffab58a2b8e35"><span><div id="1b7ee663744080ed95dffab58a2b8e35" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d071" target="_blank" rel="noopener noreferrer">d071. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d071" target="_blank" rel="noopener noreferrer">P-6-9. 大賣場免費大搬家</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b7ee663744080288da3d10a5fb819f7"><li>01 背包問題，筆記可參考<a class="notion-link" href="https://zixu.eu.org/article/%E5%82%B3%E7%B5%B1%E8%83%8C%E5%8C%85_%E7%AD%86%E8%A8%98%E6%95%B4%E7%90%86" target="_blank" rel="noopener noreferrer">這邊</a></li></ul></div></details><details class="notion-toggle notion-block-1b8ee663744080e389c5d731a189705b"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee663744080e389c5d731a189705b" data-id="1b8ee663744080e389c5d731a189705b"><span><div id="1b8ee663744080e389c5d731a189705b" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d075" target="_blank" rel="noopener noreferrer">d075. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d075" target="_blank" rel="noopener noreferrer">Q-6-10. 置物櫃出租</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee663744080fbbb2ee9a1ac123abb"><li>就是 01 背包</li></ul></div></details><details class="notion-toggle notion-block-1b8ee663744080c69bd6d7ccf6053151"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee663744080c69bd6d7ccf6053151" data-id="1b8ee663744080c69bd6d7ccf6053151"><span><div id="1b8ee663744080c69bd6d7ccf6053151" class="notion-header-anchor"></div><span class="notion-h-title"><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d076" target="_blank" rel="noopener noreferrer">d076. P-6-11. Catalan number</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee663744080a1bc40f602ee394022"><li>memorization dp</li></ul></div></details><details class="notion-toggle notion-block-1b8ee66374408059bab2df386b47838a"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee66374408059bab2df386b47838a" data-id="1b8ee66374408059bab2df386b47838a"><span><div id="1b8ee66374408059bab2df386b47838a" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d084" target="_blank" rel="noopener noreferrer">d084. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d084" target="_blank" rel="noopener noreferrer">Q-6-12. 楊鐵心做 1 休 K</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee6637440805d95d8d718bae4be37"><li>就是 d067</li></ul></div></details><details class="notion-toggle notion-block-1b8ee663744080539e43de955b801bbc"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee663744080539e43de955b801bbc" data-id="1b8ee663744080539e43de955b801bbc"><span><div id="1b8ee663744080539e43de955b801bbc" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d077" target="_blank" rel="noopener noreferrer">d077. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d077" target="_blank" rel="noopener noreferrer">P-6-13. 周伯通的基地台</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee663744080beb5c3eea47408f8c9"><li>d068 加上 Monotonic Queue 維護區間最小值</li></ul></div></details><details class="notion-toggle notion-block-1b8ee663744080839653c8a3440d23b8"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee663744080839653c8a3440d23b8" data-id="1b8ee663744080839653c8a3440d23b8"><span><div id="1b8ee663744080839653c8a3440d23b8" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d085" target="_blank" rel="noopener noreferrer">d085. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d085" target="_blank" rel="noopener noreferrer">Q-6-14. K 次買賣</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee663744080e59dd4f062104ff2d3"><li>股票買賣問題，筆記見<a class="notion-link" href="https://zixu.eu.org/article/DP%E7%B3%BB%E5%88%97%E5%95%8F%E9%A1%8C_%E9%9A%A8%E7%AD%86" target="_blank" rel="noopener noreferrer">這邊</a></li></ul><ul class="notion-list notion-list-disc notion-block-1b8ee663744080d39999ecf7bcdfb91e"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> Version</li><ul class="notion-list notion-list-disc notion-block-1b8ee663744080d39999ecf7bcdfb91e"></ul></ul><ul class="notion-list notion-list-disc notion-block-1b8ee66374408074a5f5ca128093cfce"><li><span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> Version</li><ul class="notion-list notion-list-disc notion-block-1b8ee66374408074a5f5ca128093cfce"></ul></ul></div></details><details class="notion-toggle notion-block-1b8ee663744080018afbd14a471ea64a"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee663744080018afbd14a471ea64a" data-id="1b8ee663744080018afbd14a471ea64a"><span><div id="1b8ee663744080018afbd14a471ea64a" class="notion-header-anchor"></div><span class="notion-h-title"><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d078" target="_blank" rel="noopener noreferrer">d078. P-6-15. 一覽衆山小</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee663744080bfa373c848cf8b4a15"><li>就是 LIS</li></ul><details class="notion-toggle notion-block-1b8ee663744080e59f09c89c49e282ef"><summary>這題跑 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 會TLE</summary><div></div></details><ul class="notion-list notion-list-disc notion-block-1b8ee6637440805eb388c13e4f2dbb84"><li>將 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span> 的定義改成目前最長的 LIS ，再加上二分搜，變成 <span role="button" tabindex="0" class="notion-equation notion-equation-inline"><span></span></span></li></ul></div></details><details class="notion-toggle notion-block-1bfee663744080d5a47ff640307bdf50"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1bfee663744080d5a47ff640307bdf50" data-id="1bfee663744080d5a47ff640307bdf50"><span><div id="1bfee663744080d5a47ff640307bdf50" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d118" target="_blank" rel="noopener noreferrer">d118. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d118" target="_blank" rel="noopener noreferrer">P-6-16. 山寨華山論劍</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1b8ee6637440800d88faff969b2fd7fa"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee6637440800d88faff969b2fd7fa" data-id="1b8ee6637440800d88faff969b2fd7fa"><span><div id="1b8ee6637440800d88faff969b2fd7fa" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d079" target="_blank" rel="noopener noreferrer">d079. P-6-17. 切棍子</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b8ee663744080e58123f51a4c69be6d"><li>區間 dp</li></ul></div></details><details class="notion-toggle notion-block-1b8ee66374408098a7fece03baf7b5c6"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b8ee66374408098a7fece03baf7b5c6" data-id="1b8ee66374408098a7fece03baf7b5c6"><span><div id="1b8ee66374408098a7fece03baf7b5c6" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d086" target="_blank" rel="noopener noreferrer">d086. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d086" target="_blank" rel="noopener noreferrer">Q-6-18. 矩陣乘法鏈</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1b9ee663744080258a2bffdf19a17b55"><li>跟 d079 一樣的區間 dp </li></ul></div></details><details class="notion-toggle notion-block-1b9ee663744080b0b0bafb176746d570"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b9ee663744080b0b0bafb176746d570" data-id="1b9ee663744080b0b0bafb176746d570"><span><div id="1b9ee663744080b0b0bafb176746d570" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d080" target="_blank" rel="noopener noreferrer">d080. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d080" target="_blank" rel="noopener noreferrer">P-6-19. 階梯數字</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1bbee66374408053a0baec6ad3ab9c7a"><li>數位 dp</li></ul></div></details><details class="notion-toggle notion-block-1bbee663744080cd8906c20652e8dae1"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1bbee663744080cd8906c20652e8dae1" data-id="1bbee663744080cd8906c20652e8dae1"><span><div id="1bbee663744080cd8906c20652e8dae1" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d081" target="_blank" rel="noopener noreferrer">d081. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d081" target="_blank" rel="noopener noreferrer">P-6-20. Hyper-cube path</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1bcee663744080f88f7dd03e887ed25b"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1bcee663744080f88f7dd03e887ed25b" data-id="1bcee663744080f88f7dd03e887ed25b"><span><div id="1bcee663744080f88f7dd03e887ed25b" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d082" target="_blank" rel="noopener noreferrer">d082. P-6-21. 刪除邊界</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1beee663744080eab030d4dc2b00e0b2"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1beee663744080eab030d4dc2b00e0b2" data-id="1beee663744080eab030d4dc2b00e0b2"><span><div id="1beee663744080eab030d4dc2b00e0b2" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d083" target="_blank" rel="noopener noreferrer">d083. P-6-22. 文無第一武無第二</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1c9ee663744080b4a022db00156f77b0"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1c9ee663744080b4a022db00156f77b0" data-id="1c9ee663744080b4a022db00156f77b0"><span><div id="1c9ee663744080b4a022db00156f77b0" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d087" target="_blank" rel="noopener noreferrer">d087. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d087" target="_blank" rel="noopener noreferrer">Q-6-23. 直升機抓寶</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1c9ee663744080ada359e1a5f60bf297"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1c9ee663744080ada359e1a5f60bf297" data-id="1c9ee663744080ada359e1a5f60bf297"><span><div id="1c9ee663744080ada359e1a5f60bf297" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d088" target="_blank" rel="noopener noreferrer">d088. Q-6-24. 隔離採礦</a></span></span></h3></summary><div><div class="notion-blank notion-block-1c9ee6637440801ab48dd7a1e809a15a"> </div></div></details><details class="notion-toggle notion-block-1c6ee663744080c1a0e6e602c31f6c75"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1c6ee663744080c1a0e6e602c31f6c75" data-id="1c6ee663744080c1a0e6e602c31f6c75"><span><div id="1c6ee663744080c1a0e6e602c31f6c75" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d089" target="_blank" rel="noopener noreferrer">d089. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d089" target="_blank" rel="noopener noreferrer">Q-6-25. 貨郎問題</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1d1ee663744080ad84f5f5b2c954e947"><li>TSP 問題</li></ul></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1c6ee663744080d5bc5ce7e419c0bb13" data-id="1c6ee663744080d5bc5ce7e419c0bb13"><span><div id="1c6ee663744080d5bc5ce7e419c0bb13" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1c6ee663744080d5bc5ce7e419c0bb13" title="Ch07. Graph"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ch07. Graph</span></span></h2><details class="notion-toggle notion-block-1c6ee6637440808ca0d4cf381814e6de"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1c6ee6637440808ca0d4cf381814e6de" data-id="1c6ee6637440808ca0d4cf381814e6de"><span><div id="1c6ee6637440808ca0d4cf381814e6de" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d090" target="_blank" rel="noopener noreferrer">d090. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d090" target="_blank" rel="noopener noreferrer">P-7-1. 探索距離</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1c6ee66374408063b539d1544fab7b77"><li>BFS</li></ul></div></details><details class="notion-toggle notion-block-1c6ee66374408079abb7c6dea92d452b"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1c6ee66374408079abb7c6dea92d452b" data-id="1c6ee66374408079abb7c6dea92d452b"><span><div id="1c6ee66374408079abb7c6dea92d452b" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d091" target="_blank" rel="noopener noreferrer">d091. P-7-2. 開車蒐集寶物</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1c6ee6637440805990c4d3566e07b013"><li>DFS</li></ul></div></details><details class="notion-toggle notion-block-1c6ee663744080938d9cf0f3b40ef81b"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1c6ee663744080938d9cf0f3b40ef81b" data-id="1c6ee663744080938d9cf0f3b40ef81b"><span><div id="1c6ee663744080938d9cf0f3b40ef81b" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d092" target="_blank" rel="noopener noreferrer">d092. P-7-3. 機器人走棋盤</a></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1c7ee6637440804d929cc5923974c299"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1c7ee6637440804d929cc5923974c299" data-id="1c7ee6637440804d929cc5923974c299"><span><div id="1c7ee6637440804d929cc5923974c299" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d093" target="_blank" rel="noopener noreferrer">d093. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d093" target="_blank" rel="noopener noreferrer">P-7-4. 方格棋盤的最少轉彎數路線</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1c7ee66374408049bfefea319b66a4be"><li>把轉彎當作走一步，每次都直接走到底</li></ul></div></details><details class="notion-toggle notion-block-1d1ee6637440801b9f61c2027f457617"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d1ee6637440801b9f61c2027f457617" data-id="1d1ee6637440801b9f61c2027f457617"><span><div id="1d1ee6637440801b9f61c2027f457617" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d094" target="_blank" rel="noopener noreferrer">d094. Q-7-5. 闖關路線</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1d1ee663744080e5b5d4c80b83913c6c"><li>Level Order BFS</li></ul></div></details><details class="notion-toggle notion-block-1d1ee663744080809249dad350b5f6d2"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d1ee663744080809249dad350b5f6d2" data-id="1d1ee663744080809249dad350b5f6d2"><span><div id="1d1ee663744080809249dad350b5f6d2" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d095" target="_blank" rel="noopener noreferrer">d095. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d095" target="_blank" rel="noopener noreferrer">P-7-6. DAG 的最長與最短路徑</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1d1ee663744080c0b962d6dc632d7a0b"><li>Topological Sort</li></ul></div></details><details class="notion-toggle notion-block-1d3ee66374408080bf77e38ed17dd834"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d3ee66374408080bf77e38ed17dd834" data-id="1d3ee66374408080bf77e38ed17dd834"><span><div id="1d3ee66374408080bf77e38ed17dd834" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d099" target="_blank" rel="noopener noreferrer">d099. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d099" target="_blank" rel="noopener noreferrer">Q-7-7. AOV 最早完工時間</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1d3ee663744080fb903bf2938e06a496"><li>Topological Sort → 找出最早開始與結束時間 → 找出最晚開始與結束時間 → 如果最早開始時間等於最晚開始即 critical jobs</li></ul></div></details><details class="notion-toggle notion-block-1d3ee66374408017bcf2c24af8621c0f"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d3ee66374408017bcf2c24af8621c0f" data-id="1d3ee66374408017bcf2c24af8621c0f"><span><div id="1d3ee66374408017bcf2c24af8621c0f" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d100" target="_blank" rel="noopener noreferrer">d100. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d100" target="_blank" rel="noopener noreferrer">Q-7-8. 小寶的著色問題</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1d3ee663744080759311f5bc4b0e14bb"><li>檢查是否為二分圖</li></ul></div></details><details class="notion-toggle notion-block-1d1ee6637440802baeaad7ae634bcd74"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d1ee6637440802baeaad7ae634bcd74" data-id="1d1ee6637440802baeaad7ae634bcd74"><span><div id="1d1ee6637440802baeaad7ae634bcd74" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d096" target="_blank" rel="noopener noreferrer">d096. P-7-9. 最短路徑</a></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1d1ee663744080718954c76db8192c78"><li>Dijkstra</li></ul></div></details><details class="notion-toggle notion-block-1d3ee66374408042ae59caf264f49b58"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d3ee66374408042ae59caf264f49b58" data-id="1d3ee66374408042ae59caf264f49b58"><span><div id="1d3ee66374408042ae59caf264f49b58" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d097" target="_blank" rel="noopener noreferrer">d097. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d097" target="_blank" rel="noopener noreferrer">P-7-10. 挖坑跳</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1d4ee66374408061a12aea4d7568bd30"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d4ee66374408061a12aea4d7568bd30" data-id="1d4ee66374408061a12aea4d7568bd30"><span><div id="1d4ee66374408061a12aea4d7568bd30" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d101" target="_blank" rel="noopener noreferrer">d101. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d101" target="_blank" rel="noopener noreferrer">Q-7-11. 紅白彩帶</a></b></span></span></h3></summary><div></div></details><details class="notion-toggle notion-block-1d4ee66374408064b88ad1c6bbb82d71"><summary><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d4ee66374408064b88ad1c6bbb82d71" data-id="1d4ee66374408064b88ad1c6bbb82d71"><span><div id="1d4ee66374408064b88ad1c6bbb82d71" class="notion-header-anchor"></div><span class="notion-h-title"><a class="notion-link" href="https://judge.tcirc.tw/problem/d098" target="_blank" rel="noopener noreferrer">d098. </a><b><a class="notion-link" href="https://judge.tcirc.tw/problem/d098" target="_blank" rel="noopener noreferrer">P-7-12. 最小生成樹</a></b></span></span></h3></summary><div><ul class="notion-list notion-list-disc notion-block-1d4ee663744080e9adebf145beed0b12"><li>Kruskal</li></ul></div></details><div class="notion-blank notion-block-20bee663744080c792effa9104370bac"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[登入頁面實作]]></title>
            <link>https://zixu.eu.org/article/登入頁面實作</link>
            <guid>https://zixu.eu.org/article/登入頁面實作</guid>
            <pubDate>Tue, 27 Aug 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-2a23ed4694b3469faa35607281415a89"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-sync-block notion-block-ef561d5e08474c028d56bc108716b809"><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-f4d04a97b1c5429eb43c65b485fb06d4" data-id="f4d04a97b1c5429eb43c65b485fb06d4"><span><div id="f4d04a97b1c5429eb43c65b485fb06d4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f4d04a97b1c5429eb43c65b485fb06d4" title="Environment"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Environment</span></span></h3><ul class="notion-list notion-list-disc notion-block-fee68072350c4796ba101cbf1071bdbf"><li>OS: Windows 10</li></ul><ul class="notion-list notion-list-disc notion-block-18ad9c5a25ce4daeb05ffdb2bdd1b1a6"><li>IntelliJ IDEA: 2024.2</li></ul><ul class="notion-list notion-list-disc notion-block-1e798dbe4e614e959e064fb21aa34af2"><li>java: 1.8.0_202</li></ul><ul class="notion-list notion-list-disc notion-block-1d1ace601dee4d39b435a431aac1b00a"><li>javassist: 3.12.1-GA</li></ul><ul class="notion-list notion-list-disc notion-block-1bb3cce2de414b10b4663518b11c0399"><li>tomcat: 2.2 (Maven Plugin)</li></ul><ul class="notion-list notion-list-disc notion-block-fd16d50a04f54d79918cb019478e81d4"><li>Spring: 2.7.6</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-3bda52f346954810bf34cbc58535bd59" data-id="3bda52f346954810bf34cbc58535bd59"><span><div id="3bda52f346954810bf34cbc58535bd59" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3bda52f346954810bf34cbc58535bd59" title="Objective"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Objective</span></span></h3><div class="notion-text notion-block-9e3c297b9820415ba49f78a356dc876b">實作登入頁面，並以各種方式實現使用者記憶功能，已經登入過的使用者無須再次登入。</div><div class="notion-blank notion-block-c7703045783a43819d34d299db10e3bd"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-d556fd34c3514db68a4da8e6aa819317" data-id="d556fd34c3514db68a4da8e6aa819317"><span><div id="d556fd34c3514db68a4da8e6aa819317" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d556fd34c3514db68a4da8e6aa819317" title="Studying"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Studying</span></span></h3><div class="notion-text notion-block-aba5b4b9c27e42d6a6414b15f47b7c71"><a class="notion-link" href="https://www.bilibili.com/video/BV1Qf4y1T7Hx?p=99&amp;vd_source=58688080d63071e19c361b16a51a87d2" target="_blank" rel="noopener noreferrer">Request and Response</a></div><div class="notion-text notion-block-258d8667b4cf48f7a44a42932c194a98"><a class="notion-link" href="https://liaoxuefeng.com/books/java/spring/web/mvc/" target="_blank" rel="noopener noreferrer">使用 Spring MVC</a></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-ecacb80053e14de5b1c5f5f1bab8f516" data-id="ecacb80053e14de5b1c5f5f1bab8f516"><span><div id="ecacb80053e14de5b1c5f5f1bab8f516" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ecacb80053e14de5b1c5f5f1bab8f516" title="Implementation"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Implementation</span></span></h3><ul class="notion-list notion-list-disc notion-block-21e22c2f06e44bf98b192e56b66a38f4"><li>Servlet+Cookie </li><ul class="notion-list notion-list-disc notion-block-21e22c2f06e44bf98b192e56b66a38f4"><li>實作 <code class="notion-inline-code">login.html</code>, <code class="notion-inline-code">Entry.java</code>, <code class="notion-inline-code">Login.java</code>以及<code class="notion-inline-code">Main.java</code> 四個檔案。</li><details class="notion-toggle notion-block-4ad8c65a1f1b41d28ce5f27e7b253b66"><summary><code class="notion-inline-code">login.html</code></summary><div><ul class="notion-list notion-list-disc notion-block-27de92a8929c41279c58999be49e7ad2"><li>主要用途：提供使用者操作，取得 username 以及 password</li></ul><ul class="notion-list notion-list-disc notion-block-3732547274544cdc84c9e1f377b1bca5"><li>入口：<code class="notion-inline-code">login.html</code></li></ul></div></details><details class="notion-toggle notion-block-f55aef41450341b7b0efb7d00d78e75b"><summary><code class="notion-inline-code">Entry.java</code></summary><div><ul class="notion-list notion-list-disc notion-block-e7cf6f82bb52454691d0e9d43aeb89e7"><li>主要用途：入口網站，根據 Cookie 的內容將使用者的 request 轉發到 <code class="notion-inline-code">login</code> 或是 <code class="notion-inline-code">mainPage</code></li></ul><ul class="notion-list notion-list-disc notion-block-f1d437346b4b486d83d9ef90e6d3fc8a"><li>入口：<code class="notion-inline-code">entry</code></li></ul></div></details><details class="notion-toggle notion-block-08aad0dd4b8d435a89b001e5ba0aee33"><summary><code class="notion-inline-code">Login.java</code></summary><div><ul class="notion-list notion-list-disc notion-block-0ef44df755d640208ad1abb4aaa86227"><li>主要用途：對於使用者的名稱與密碼做驗證、將成功登入的使用者名稱加在請求的 Cookie 中。</li></ul><ul class="notion-list notion-list-disc notion-block-7c83131045fe4e11b2cc30e934bac098"><li>入口：<code class="notion-inline-code">loginPage</code></li></ul><ul class="notion-list notion-list-disc notion-block-b3335358071442b8875b5469431c3d08"><li>備註：此處並無實作 DB 驗證，因此一律視為使用者成功登入。</li></ul></div></details><details class="notion-toggle notion-block-28b0cbda327a4c31b15343343372f029"><summary><code class="notion-inline-code">Main.java</code></summary><div><ul class="notion-list notion-list-disc notion-block-502478875a7d434697d194f5127c4de0"><li>主要用途：成功登入的頁面，此處以顯示使用者名稱為模擬。</li></ul><ul class="notion-list notion-list-disc notion-block-1bf79d3ffdf7472eae542da05f69f060"><li>入口：<code class="notion-inline-code">mainPage</code> </li></ul></div></details></ul></ul><ul class="notion-list notion-list-disc notion-block-69aea89d41f4410aa155086638f918ac"><li>Spring+Session</li><ul class="notion-list notion-list-disc notion-block-69aea89d41f4410aa155086638f918ac"><li>配合 Java 8，Spring 須採用 2.7.6 以下的版本，而官方提供的 Initializer 已停止支援，此處採用<a class="notion-link" href="https://start.aliyun.com/" target="_blank" rel="noopener noreferrer">鏡像網站</a>代替建立空的專案。</li><li>為了返回動態模板網頁，需要 import thymleaf lib</li><ul class="notion-list notion-list-disc notion-block-584234b9aef046a8a38aadfd0a7fe259"><details class="notion-toggle notion-block-dfe77695371b4ace8bad3afcbd067164"><summary><code class="notion-inline-code">pom.xml</code></summary><div></div></details></ul><li>在 <code class="notion-inline-code">src/main/org/demo</code> 底下新建 <code class="notion-inline-code">LoginController.java</code>，負責針對使用者的登入操作做判斷。</li><ul class="notion-list notion-list-disc notion-block-661ed6ac76954df197119b9412bd7f48"><details class="notion-toggle notion-block-bfbe0c4e22a44514bb2697384d0fe1a1"><summary><code class="notion-inline-code">LoginController.java</code></summary><div></div></details></ul><li>根據判斷請求方法是 Get 或是 Post 可以得知是使用者的訪問操作或是填寫完訊息的提交操作，如果是提交操作就將 username 寫進 session 中。</li><li>準備填寫資訊的網頁，創建檔案並置於 <code class="notion-inline-code">src/main/resources/templates</code></li><ul class="notion-list notion-list-disc notion-block-79bd331d4dd646cb9dfd049b04fa35c2"><details class="notion-toggle notion-block-54fb89a0f1fa4d27a26503c4bb99b4b5"><summary><code class="notion-inline-code">login.html</code></summary><div></div></details></ul><li>此處以登入成功並透過 thymleaf 套件顯示使用者名稱模擬登入成功之情境</li><ul class="notion-list notion-list-disc notion-block-02ca71e55b4f4f85970fe800ddb3d10e"><details class="notion-toggle notion-block-1f1d276e1fa94c00b33e80312a010edc"><summary><code class="notion-inline-code">welcome.html</code></summary><div></div></details></ul></ul></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-32dea77f5f124ee2b4d0c056db6458ea" data-id="32dea77f5f124ee2b4d0c056db6458ea"><span><div id="32dea77f5f124ee2b4d0c056db6458ea" class="notion-header-anchor"></div><a class="notion-hash-link" href="#32dea77f5f124ee2b4d0c056db6458ea" title="Takeaway "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Takeaway </span></span></h3><div class="notion-text notion-block-71f626dcd61e4bb291c95a979f17d7b1">Cookie 相關知識與語法操作</div><div class="notion-text notion-block-ec07ec9b9e9b41458b1bdea12c8970f6">Spring 框架相關知識</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-7c00ef546f5a49a08dbe791e80c3ad67" data-id="7c00ef546f5a49a08dbe791e80c3ad67"><span><div id="7c00ef546f5a49a08dbe791e80c3ad67" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7c00ef546f5a49a08dbe791e80c3ad67" title="Code"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><a class="notion-link" href="https://github.com/Zixu203/WorkStudy_Login" target="_blank" rel="noopener noreferrer">Code</a></span></span></h3></div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java Web 入門課]]></title>
            <link>https://zixu.eu.org/article/Java_Web_入門課</link>
            <guid>https://zixu.eu.org/article/Java_Web_入門課</guid>
            <pubDate>Tue, 27 Aug 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-a9a4d6fd325d4ca0ab0e2d2cb5e007a9"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-sync-block notion-block-4a60b60a3c6b4c47af9b7dfdbd6142a7"><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-9f9b8ad6c99e4316a49437fb645d1c4d" data-id="9f9b8ad6c99e4316a49437fb645d1c4d"><span><div id="9f9b8ad6c99e4316a49437fb645d1c4d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9f9b8ad6c99e4316a49437fb645d1c4d" title="Environment"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Environment</span></span></h3><ul class="notion-list notion-list-disc notion-block-eb25d397d3f24c559b3f67c08b229681"><li>OS: Windows 10</li></ul><ul class="notion-list notion-list-disc notion-block-a59164d54d564b23b68822a7f36e7f75"><li>IntelliJ IDEA: 2024.2</li></ul><ul class="notion-list notion-list-disc notion-block-0facddba6cad4916afa5dbe909b43acf"><li>java: 1.8.0_202</li></ul><ul class="notion-list notion-list-disc notion-block-5260e4497e374d80b37cfa3f7b635dc1"><li>javassist: 3.12.1-GA</li></ul><ul class="notion-list notion-list-disc notion-block-91921afd50114785a61aa3de8c9d5f9b"><li>tomcat: 2.2 (Maven Plugin)</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-3cb25005e90944c3a53e65e340123c82" data-id="3cb25005e90944c3a53e65e340123c82"><span><div id="3cb25005e90944c3a53e65e340123c82" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3cb25005e90944c3a53e65e340123c82" title="Objective"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Objective</span></span></h3><div class="notion-text notion-block-3a998aa720b64f2fb2ad2a3743fb415a">使用 tomcat 建立伺服器，並建立簡單的網站</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-82c6effc8b854e5aa5dc6f903ac592f9" data-id="82c6effc8b854e5aa5dc6f903ac592f9"><span><div id="82c6effc8b854e5aa5dc6f903ac592f9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#82c6effc8b854e5aa5dc6f903ac592f9" title="Studying"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Studying</span></span></h3><div class="notion-text notion-block-c5c21b1668364e9c9a7c8436b58e0fbd"><a class="notion-link" href="https://www.bilibili.com/video/BV1Qf4y1T7Hx?p=94&amp;vd_source=58688080d63071e19c361b16a51a87d2" target="_blank" rel="noopener noreferrer">Servlet简介</a></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-5b0e43d8de7241158dac3bcb69b6e59b" data-id="5b0e43d8de7241158dac3bcb69b6e59b"><span><div id="5b0e43d8de7241158dac3bcb69b6e59b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#5b0e43d8de7241158dac3bcb69b6e59b" title="Implementation"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Implementation</span></span></h3><div class="notion-blank notion-block-a4140645b1ef4c198f703bb4885e0f71"> </div><ol start="1" class="notion-list notion-list-numbered notion-block-88e4b943ce3847ecbabbf9b13f4324df" style="list-style-type:decimal"><li>新建 Maven Archetype → webapp</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-ed986bc733c34f9b9d642888bd785e80" style="list-style-type:decimal"><li>引入 tomcat 插件</li><ol class="notion-list notion-list-numbered notion-block-ed986bc733c34f9b9d642888bd785e80" style="list-style-type:lower-alpha"><details class="notion-toggle notion-block-3e8197b7f92149e3b79fc36d44bd7d00"><summary><code class="notion-inline-code">pom.xml</code></summary><div></div></details></ol></ol><ol start="3" class="notion-list notion-list-numbered notion-block-67718afe4f714bd9aecae032156e4224" style="list-style-type:decimal"><li>試運行專案 → Maven Panel → tomcat7 → run</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-ea37fe189f994922959990683e147ece" style="list-style-type:decimal"><li>訪問網站 → <code class="notion-inline-code">127.0.0.1:8080</code></li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-79de1ad7161b4b3d82d4dfb53700fda4" style="list-style-type:decimal"><li>引入 Servlet 套件</li><ol class="notion-list notion-list-numbered notion-block-79de1ad7161b4b3d82d4dfb53700fda4" style="list-style-type:lower-alpha"><details class="notion-toggle notion-block-27e1f90ae15b4b48bfbf0534db649768"><summary><code class="notion-inline-code">pom.xml</code></summary><div></div></details></ol></ol><ol start="6" class="notion-list notion-list-numbered notion-block-1166e65b0ddc45fc825e4b07203e0c9e" style="list-style-type:decimal"><li>原型 Servlet 示範檔案 (<code class="notion-inline-code">src/main/java/org/Demo1.java</code>)</li><ol class="notion-list notion-list-numbered notion-block-1166e65b0ddc45fc825e4b07203e0c9e" style="list-style-type:lower-alpha"><details class="notion-toggle notion-block-35db3c1d3b314168a6e4836ed5683153"><summary><code class="notion-inline-code">Demo1.java</code></summary><div></div></details></ol></ol><ol start="7" class="notion-list notion-list-numbered notion-block-5adf5eb3b3894bcbb2756d21ad19c96f" style="list-style-type:decimal"><li>訪問頁面 → <code class="notion-inline-code">127.0.0.1:8080/Demo1</code></li></ol><ol start="8" class="notion-list notion-list-numbered notion-block-bcb349d699804100b86f80fe92b2ec0d" style="list-style-type:decimal"><li>HTTP 封裝型 Servlet 示範檔案 (<code class="notion-inline-code">src/main/java/org/Demo2.java</code>)</li><ol class="notion-list notion-list-numbered notion-block-bcb349d699804100b86f80fe92b2ec0d" style="list-style-type:lower-alpha"><details class="notion-toggle notion-block-b1a81bd641f84d7981eeaa0751e11478"><summary><code class="notion-inline-code">Demo2.java</code></summary><div></div></details></ol></ol><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-64b3f27f13614414b5bc31edba399227" data-id="64b3f27f13614414b5bc31edba399227"><span><div id="64b3f27f13614414b5bc31edba399227" class="notion-header-anchor"></div><a class="notion-hash-link" href="#64b3f27f13614414b5bc31edba399227" title="Code"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><a class="notion-link" href="https://github.com/Zixu203/JavaWeb" target="_blank" rel="noopener noreferrer">Code</a></span></span></h3><div class="notion-text notion-block-a63ee99b09394f17b3bd85329a6cb23a"></div></div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring 入門課]]></title>
            <link>https://zixu.eu.org/article/Spring_入門課</link>
            <guid>https://zixu.eu.org/article/Spring_入門課</guid>
            <pubDate>Tue, 27 Aug 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-2ea95f8cf61542ee93ab70b23e01fcdb"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-sync-block notion-block-3e6830e95d894a76bb3f04e7becaaa48"><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-a6e9f40ef14647c69cb7ed70cad54549" data-id="a6e9f40ef14647c69cb7ed70cad54549"><span><div id="a6e9f40ef14647c69cb7ed70cad54549" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a6e9f40ef14647c69cb7ed70cad54549" title="Environment"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Environment</span></span></h3><ul class="notion-list notion-list-disc notion-block-2d3061ba43d348a9b2927bfcd8d9e696"><li>OS: Windows 10</li></ul><ul class="notion-list notion-list-disc notion-block-50d780402df245d5b84a214ad70cd6e0"><li>IntelliJ IDEA: 2024.2</li></ul><ul class="notion-list notion-list-disc notion-block-6bb8d41a4abd45d0ac4afdb074dcaac2"><li>java: 1.8.0_202</li></ul><ul class="notion-list notion-list-disc notion-block-1c7ddc9a9ebb4836b7c8cdc8152643a2"><li>javassist: 3.12.1-GA</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-7a47d3ce4ba9486685ad356fc57c49ed" data-id="7a47d3ce4ba9486685ad356fc57c49ed"><span><div id="7a47d3ce4ba9486685ad356fc57c49ed" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7a47d3ce4ba9486685ad356fc57c49ed" title="Studying"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Studying</span></span></h3><div class="notion-blank notion-block-45ebc37f86ef47aead3bec2c539c2b45"> </div><div class="notion-text notion-block-182585f6f7434d4b8a6f182a09c57387"><a class="notion-link" href="https://liaoxuefeng.com/books/java/spring/index.html" target="_blank" rel="noopener noreferrer">Spring开发</a></div><div class="notion-blank notion-block-0929990560294a73964fb88f795c6151"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-dd91151409ae4bd2b7277cff3b6ead32" data-id="dd91151409ae4bd2b7277cff3b6ead32"><span><div id="dd91151409ae4bd2b7277cff3b6ead32" class="notion-header-anchor"></div><a class="notion-hash-link" href="#dd91151409ae4bd2b7277cff3b6ead32" title="Note"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Note</span></span></h3><div class="notion-blank notion-block-34d7c227318f43429ef93752dc98681b"> </div><ul class="notion-list notion-list-disc notion-block-7d2d3b0725f549bd96da97248a15ba49"><li>Reflection </li><ul class="notion-list notion-list-disc notion-block-7d2d3b0725f549bd96da97248a15ba49"><li>Java 在 runtime 時，可以動態操作 Class 的方法 (e.g. 載入、檢視、生成物件、操作物件)</li></ul></ul><ul class="notion-list notion-list-disc notion-block-aa04d31872cc4b06a749f82bd4f00562"><li>Bean </li><ul class="notion-list notion-list-disc notion-block-aa04d31872cc4b06a749f82bd4f00562"><li>符合以下規範的 Java Class</li><li>getter: <code class="notion-inline-code">public Type getXyz()</code></li><li>setter: <code class="notion-inline-code">public void setXyz(Type val)</code> </li><li>將一組對應的 getter 與 setter function 稱作 propetry</li></ul></ul><ul class="notion-list notion-list-disc notion-block-79cf49194ee84f4a8c63716d9126e727"><li>IoC</li><ul class="notion-list notion-list-disc notion-block-79cf49194ee84f4a8c63716d9126e727"><li>Inverse of Control</li><li>盡量避免由模組創建新物件，而是由 IoC 容器統一負責新物件的創立，再由模組內的 set function 傳遞給模組，稱為依賴注入(DI, Dependency Injection)</li><li>e.g. 許多模組對於 db 的操作，每個模組自己創建 db 物件 → 統一跟 IoC 容器要，對於 db 配置、連線等等操作只須執行一次。</li></ul></ul><ul class="notion-list notion-list-disc notion-block-810cfbcc62f54d94ae8b883944794dd5"></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-adfcc5cfe29144d5a3d6fdf0ba492f5b" data-id="adfcc5cfe29144d5a3d6fdf0ba492f5b"><span><div id="adfcc5cfe29144d5a3d6fdf0ba492f5b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#adfcc5cfe29144d5a3d6fdf0ba492f5b" title="Implementation"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Implementation</span></span></h3><div class="notion-blank notion-block-944304be84624be197dded2ebb66f876"> </div><div class="notion-blank notion-block-2ec230132cfd464585bdab708be33c64"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-0e60e9e8922e443382f390b30ad79c87" data-id="0e60e9e8922e443382f390b30ad79c87"><span><div id="0e60e9e8922e443382f390b30ad79c87" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0e60e9e8922e443382f390b30ad79c87" title="Takeaway "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Takeaway </span></span></h3><div class="notion-blank notion-block-a79cf059207f4062b978974ad73b2216"> </div><div class="notion-blank notion-block-abd5de92d29048178c5330c45aa47efb"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-dc2b58a7eed74c328b603a6b2162fd24" data-id="dc2b58a7eed74c328b603a6b2162fd24"><span><div id="dc2b58a7eed74c328b603a6b2162fd24" class="notion-header-anchor"></div><a class="notion-hash-link" href="#dc2b58a7eed74c328b603a6b2162fd24" title="Problem"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Problem</span></span></h3><div class="notion-blank notion-block-a4abf72ffef8449fbc75f52ac5258038"> </div><div class="notion-blank notion-block-61beff173cd44540b86e45f32e6028a9"> </div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-506810d72df04c71a8cafe2cc05d4aa8" data-id="506810d72df04c71a8cafe2cc05d4aa8"><span><div id="506810d72df04c71a8cafe2cc05d4aa8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#506810d72df04c71a8cafe2cc05d4aa8" title="Code"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Code</span></span></h3><div class="notion-blank notion-block-b7b52c2b9ac949a889d83f7b7c30466b"> </div><div class="notion-blank notion-block-0deac9e0eee243efa551074ef99a1df4"> </div></div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java 入門課]]></title>
            <link>https://zixu.eu.org/article/Java_入門課</link>
            <guid>https://zixu.eu.org/article/Java_入門課</guid>
            <pubDate>Mon, 26 Aug 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-b016629cb4ca4524bb105c2043743f9b"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-sync-block notion-block-65a46377a4014e0c99d867df59a2c4a8"><details class="notion-toggle notion-block-fab6b01059114a48817efb799ffeacd3"><summary>Directory</summary><div><div class="notion-table-of-contents notion-gray notion-block-b57fb409cb5749ea919e55b713cde3a3"><a href="#c5e3203679614f30a99d7f53cf20da12" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Diary</span></a><a href="#b004dae5fc1a425b83beb5d1509a0386" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">2024/08/26</span></a><a href="#fdb718dbbe4d4908a2f9e43fd5022d66" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">2024/08/27</span></a><a href="#b1f01e62654240aa9f9dc5c095d5b34f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">2024/08/28 </span></a></div></div></details><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-c5e3203679614f30a99d7f53cf20da12" data-id="c5e3203679614f30a99d7f53cf20da12"><span><div id="c5e3203679614f30a99d7f53cf20da12" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c5e3203679614f30a99d7f53cf20da12" title="Diary"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Diary</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-b004dae5fc1a425b83beb5d1509a0386" data-id="b004dae5fc1a425b83beb5d1509a0386"><span><div id="b004dae5fc1a425b83beb5d1509a0386" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b004dae5fc1a425b83beb5d1509a0386" title="2024/08/26"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2024/08/26</span></span></h3><ul class="notion-list notion-list-disc notion-block-3c33265b25f84c48a4735de0db297630"><li>Tomcat 配置</li></ul><ul class="notion-list notion-list-disc notion-block-59c4c354c62c4f2fbf27c7ecb47e1a43"><li>Maven 架構</li></ul><ul class="notion-list notion-list-disc notion-block-facdd9ace9814fe79abd29c43f6fe9b9"><li>war 打包</li></ul><ul class="notion-list notion-list-disc notion-block-27d28c3d14a0474a8d63e65196f5487b"><li>Tomcat 集成 IDEA</li></ul><ul class="notion-list notion-list-disc notion-block-327df3a662fd45f4968c3915accc2e61"><li>Servlet 概念</li></ul><ul class="notion-list notion-list-disc notion-block-b0c31cdceb854859ad75b25b40e3826c"><li>配置基礎 Servlet 頁面</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-fdb718dbbe4d4908a2f9e43fd5022d66" data-id="fdb718dbbe4d4908a2f9e43fd5022d66"><span><div id="fdb718dbbe4d4908a2f9e43fd5022d66" class="notion-header-anchor"></div><a class="notion-hash-link" href="#fdb718dbbe4d4908a2f9e43fd5022d66" title="2024/08/27"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2024/08/27</span></span></h3><ul class="notion-list notion-list-disc notion-block-193cfd64be16470da422ed00c7d15238"><li>自行封裝 HttpServlet 物件</li></ul><ul class="notion-list notion-list-disc notion-block-b963f1b0748f4129becd92d7eb1fa5cf"><li>使用 XML 配置 Servlet 路徑</li></ul><ul class="notion-list notion-list-disc notion-block-853625f9c1bf4a688bdc9be04210dc6f"><li>解決請求路徑中文亂碼問題</li></ul><ul class="notion-list notion-list-disc notion-block-f803c7ebadbe468487de4b5b215b1d24"><li>JSP 概念</li></ul><ul class="notion-list notion-list-disc notion-block-a942908b022e4d5f8697bd4b0d69115a"><li>Cookie 與 Session 基本原理與實作</li></ul><ul class="notion-list notion-list-disc notion-block-d59887ebf66f438fbd75c80125a13878"><li>Ajax 與 Axios 基礎概念</li></ul><ul class="notion-list notion-list-disc notion-block-47b4e31ab13c4d8194ea65b7bbebebfa"><li>Spring 入門</li></ul><ul class="notion-list notion-list-disc notion-block-36e34b8ed6b745f3be07e7809293d8c4"><li>Study 3 - 以 Cookie 方式實作 </li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-b1f01e62654240aa9f9dc5c095d5b34f" data-id="b1f01e62654240aa9f9dc5c095d5b34f"><span><div id="b1f01e62654240aa9f9dc5c095d5b34f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b1f01e62654240aa9f9dc5c095d5b34f" title="2024/08/28 "><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2024/08/28 </span></span></h3><ul class="notion-list notion-list-disc notion-block-a371ca09f9894846aaff3437c1c05d4b"><li>Connection Pool (e.g. druid, CP30)</li></ul><ul class="notion-list notion-list-disc notion-block-38fdc538f5eb46c7a1ee9261bb864747"><li>Study 3 - 以 Spring 方式實作</li></ul><ul class="notion-list notion-list-disc notion-block-005d642e847b473daeec5e9d5363aaca"><li>Reflection 相關知識</li></ul><div class="notion-blank notion-block-899db55a4ed44dca89c387132a320ccd"> </div><div class="notion-blank notion-block-7e5e1bc4a783411b8f9b5bcc56c54a9f"> </div><div class="notion-blank notion-block-a9ac8ebce7614fa28c9c344ae1a27ffd"> </div></div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>