Loading docs/search/opt.md +18 −16 Original line number Diff line number Diff line Loading @@ -144,7 +144,8 @@ int time[N][N];// 完成某项工作所需的时间 int cost_time_total_min; // 完成 n 份工作的最小时间总和 // i 表示第几个人,count 表示工作费用总和 inline void work(int i, int count, int n) { // 如果 i 超出了所能分配的最大工作件数,表示分配完成,并且 count 比原来 cost_time_total_min 花费少,则更新 cost_time_total_min 的值 // 如果 i 超出了所能分配的最大工作件数,表示分配完成,并且 count 比原来 // cost_time_total_min 花费少,则更新 cost_time_total_min 的值 if (i > n && count < cost_time_total_min) { cost_time_total_min = count; return; Loading @@ -159,7 +160,8 @@ inline void work(int i, int count, int n) { is_working[j] = 1; // 工作交给第 i + 1 个人 work(i + 1, count + time[i][j], n); // 在一轮迭代完成之后,返回到上一个人,要对此次的工作进行重新分配,将 is_working[j] 重设为 0 // 在一轮迭代完成之后,返回到上一个人,要对此次的工作进行重新分配,将 // is_working[j] 重设为 0 is_working[j] = 0; } } Loading Loading
docs/search/opt.md +18 −16 Original line number Diff line number Diff line Loading @@ -144,7 +144,8 @@ int time[N][N];// 完成某项工作所需的时间 int cost_time_total_min; // 完成 n 份工作的最小时间总和 // i 表示第几个人,count 表示工作费用总和 inline void work(int i, int count, int n) { // 如果 i 超出了所能分配的最大工作件数,表示分配完成,并且 count 比原来 cost_time_total_min 花费少,则更新 cost_time_total_min 的值 // 如果 i 超出了所能分配的最大工作件数,表示分配完成,并且 count 比原来 // cost_time_total_min 花费少,则更新 cost_time_total_min 的值 if (i > n && count < cost_time_total_min) { cost_time_total_min = count; return; Loading @@ -159,7 +160,8 @@ inline void work(int i, int count, int n) { is_working[j] = 1; // 工作交给第 i + 1 个人 work(i + 1, count + time[i][j], n); // 在一轮迭代完成之后,返回到上一个人,要对此次的工作进行重新分配,将 is_working[j] 重设为 0 // 在一轮迭代完成之后,返回到上一个人,要对此次的工作进行重新分配,将 // is_working[j] 重设为 0 is_working[j] = 0; } } Loading