OSDN Git Service

Update knapsack.md
author雷蒻 <34390285+hsfzLZH1@users.noreply.github.com>
Fri, 2 Aug 2019 23:20:33 +0000 (07:20 +0800)
committerGitHub <noreply@github.com>
Fri, 2 Aug 2019 23:20:33 +0000 (07:20 +0800)
docs/dp/knapsack.md

index 2fbff19..9b9801f 100644 (file)
@@ -55,7 +55,7 @@ for (int i = 1; i <= W; i++)
 
 ??? 例题代码
 
-    ```cpp
+    ```cpp
     #include <iostream>
     const int maxn = 13010;
     int n, v, w[maxn], v[maxn], f[maxn];
@@ -70,7 +70,7 @@ for (int i = 1; i <= W; i++)
         std::cout << f[W];
         return 0;
     }
-    ```
+    ```
 
 ## 完全背包
 
@@ -105,7 +105,7 @@ $$
 
 ??? 例题代码
 
-    ```cpp
+    ```cpp
     #include <iostream>
     const int maxn = 13010;
     int n, v, w[maxn], v[maxn], f[maxn];
@@ -120,7 +120,7 @@ $$
         std::cout << f[W];
         return 0;
     }
-    ```
+    ```
 
 ## 多重背包
 
@@ -153,7 +153,7 @@ $$
 
 ??? 二进制分组代码
 
-    ```cpp
+    ```cpp
     index = 0;
     for(int i = 1; i <= m; i++) {
         int c = 1, p, h, k;
@@ -167,7 +167,7 @@ $$
         list[++index].w = p * k; 
         list[index].v = h * k;
     }
-    ```
+    ```
 
 ??? note "[「Luogu P1776」宝物筛选\_NOI 导刊 2010 提高(02)](https://www.luogu.org/problemnew/show/P1776)"
     题意概要:有 $n$ 种物品和一个容量为 $W$ 的背包,每种物品有重量 $w_{i}$ ,价值 $v_{i}$ 和数量 $m_v{i}$ 两种属性,要求选若干个物品放入背包使背包中物品的总价值最大且背包中物品的总重量不超过背包的容量。有一点需要注意的是本题数据范围较大,情况较多。