貪心

例題1 #include <stdio.h> #include <string.h> #include using namespace std; #define MAXN 20 //最多集裝箱個數 //問題表示 int w[]={0,5,2,6,4,3}; //各集裝箱重量,不用下標0的元素 int n=5,W=10; //求解結果表示 int maxw; //存放最優解的總重量 int x[MA
相關文章
相關標籤/搜索