洛谷P2984《[USACO10FEB]給巧克力Chocolate Giving》
原更新日期:2019-01-10 22:06:13
此時一位單身
相關推薦
洛谷P2984《[USACO10FEB]給巧克力Chocolate Giving》
原更新日期:2019-01-10 22:06:13 此時一位單身
洛谷 P7450 - [THUSCH2017] 巧克力(斯坦納樹+隨機化)
斯坦納樹+狀壓 dp 解決特殊情況+隨機化將一般情況轉化為特殊情況,好題 洛谷題面傳送門
題解 洛谷 P4632 【[APIO2018] New Home 新家】
首先考慮可以用二分答案來解決詢問,可以二分一個長度\\(len\\),若在區間\\([x-len,x+len]\\)內包含了所有\\(k\\)種的商店,那麼這個\\(len\\)就是合法的,可以通過二分來求其最小值。
互不侵犯(洛谷P1896)
題目:在N*N的棋盤裡面放k個國王,使他們互不攻擊,共有多少種擺放方案。國王能攻擊到它上下左右,以及左上左下右上右下八個方向上附近的各一個格子,共8個格子。
【洛谷P6623】樹
題目 題目連結:https://www.luogu.com.cn/problem/P6623 給定一棵 \\(n\\) 個結點的有根樹 \\(T\\),結點從 \\(1\\) 開始編號,根結點為 \\(1\\) 號結點,每個結點有一個正整數權值 \\(v_i\\)。
洛谷-P1115 最大子段和
洛谷-P1115 最大子段和 原題連結:https://www.luogu.com.cn/problem/P1115 題目描述 輸入格式
洛谷 P3916 【圖的遍歷】
這道題綠題有點高了吧... 我一開始的思路就是一個暴力的遍歷,用遞迴加一個記憶化,對於一個點不斷的往下搜尋,然後確定最大的,返回,給上面的節點。就在這個過程中,我們是搜到最大的數然後返回給上層的數,那我們
洛谷-P1449 字尾表示式
洛谷-P1449 字尾表示式 原題連結:https://www.luogu.com.cn/problem/P1449 題目描述 輸入格式
洛谷 P3385 【【模板】負環】
這道題我又用的Ford。誰叫Ford好寫啊。 出現負環就會一直重新更新一個節點,而一個點最多隻會被更新\\(n-1\\)次,所以跑完\\(Ford\\)後,再看有沒有節點可以更新即可。
洛谷P2651 新增括號III
地址:https://www.luogu.com.cn/problem/P2651 題意如此 解析: 要想分數可化為整數,那麼分子與分母的最大公因數為分母本身。
洛谷P2574 XOR的藝術
題目描述 AKN 覺得第一題太水了,不屑於寫第一題,所以他又玩起了新的遊戲。在遊戲中,他發現,這個遊戲的傷害計算有一個規律,規律如下
洛谷p1816忠誠
之前寫過一篇這個題的題解,不過那篇只有程式碼所以補充一下。 題目描述 老管家是一個聰明能幹的人。他為財主工作了整整10年,財主為了讓自已賬目更加清楚。要求管家每天記k次賬,由於管家聰明能幹,因而管家總是讓
洛谷 P4042 [AHOI2014/JSOI2014]騎士遊戲
題意 有\\(n\\)個怪物,可以消耗\\(k\\)的代價消滅一個怪物或者消耗\\(s\\)的代價將它變成另外一個或多個新的怪物,求消滅怪物$的最小代價
洛谷-P1164 小A點菜
洛谷-P1164 小A點菜 原題連結:https://www.luogu.com.cn/problem/P1164 題目背景 題目描述 輸入格式
洛谷P1622 釋放囚犯(dp好題)
釋放囚犯 題目描述 \\(Caima\\) 王國中有一個奇怪的監獄,這個監獄一共有\\(P\\)個牢房,這些牢房一字排開,第\\(i\\)個緊挨著第\\(i+1\\)個(最後一個除外)。現在正好牢房是滿的。
【洛谷】--P2704 [NOI2001]炮兵陣地
題目描述 司令部的將軍們打算在 \\(N*M\\) 的網格地圖上部署他們的炮兵部隊。一個\\(N*M\\) 的地圖由N行M列組成,地圖的每一格可能是山地(用“\\(H\\)” 表示),也可能是平原(用“\\(P\\)”表示),如下圖。在每一
洛谷 P3332 [ZJOI2013]K大數查詢
有 \\(n\\) 個初始為空的可重集,請你維護以下操作:區間插入一個數;詢問區間第 \\(k\\) 大。
洛谷P1090 合併果子(優先佇列+貪心)
地址:https://www.luogu.com.cn/problem/P1090 解析: 要想最後花費最少,肯定每次要加入兩個最小值。
洛谷 P1080 國王遊戲 題解
原題 傳送門 思路 分析 我們先假設隊伍如下: People left hand right hand Before \\(S_a\\) A \\(a_1\\)
洛谷P1208 混合牛奶(貪心)
地址:https://www.luogu.com.cn/problem/P1208 解析: 單價p,可完成數x 要想保證花費最少,有貪心思路: