int Efficiency[PROGRAMMER_NUMBER][TASK_NUMBER]={{1,2,3,4,5},
{2,3,4,5,6},
{3,4,5,6,7},
{4,5,6,7,8},
{8,6,7,8,9}};
BOOL IsTaskSelected[TASK_NUMBER];
int main(int argc, char *argv[]) {
int task_index;
int programmer_index;
for(task_index=0;task_index
IsTaskSelected[task_index]=FALSE;
printf("The least time is %d\n",SearchStep(0));
return 0;
}
int SearchStep(int Step_index) //Return the best choice in each step
{
int best_choice=MAX_TIME;
int result;
int task_index;
if (Step_index
{
for(task_index=0;task_index
{
if(IsTaskSelected[task_index]==FALSE)
{
IsTaskSelected[task_index]=TRUE;
result=MAX_NUMBER(SearchStep(Step_index+1),Efficiency[Step_index][task_index]);
if(best_choice>result)
best_choice=result;
IsTaskSelected[task_index]=FALSE;
}
}
return best_choice;
}
else
{
for(task_index=0;task_index
if(IsTaskSelected[task_index]==FALSE)
return Efficiency[Step_index][task_index];
}
}