皮皮学,免费搜题
登录
搜题
【简答题】
阅读以下说明和C程序,将应填入(n)处的字句写在答题纸的对应栏内。 【说明】 假设需要将N个任务分配给N个工人同时去完成,每个人承担这N个任务, 但费用不同。下面的程序用回溯法计算总费用最小的一种工作分配方案,在该方案中,为每个人分配1个不同的任务。 ,N个任务从0开始依次编号,N个工人也从0开始依次编号,主要的变量说明如下: c[i][j]:将任务i分配给工人j的费用; task[i]:值为0表示任务i未分配,值为j表示任务i分配给工人j; worker[k]:值为0表示工人k未分配任务,值为1表示工人k已分配任务; mincost:最费用。 【C程序】 #include<stdio.h> #define N 8 /*N表示任务数和工人数*/ int c[N][N]; unsigned int mincost=65535; /*设置min的初始值,大于可能的总费用*/ int task[N],temp[N],workerIN]; void Plan(int k,unsigned Int cost) { int i; if ((1)&&cost<mincost){ mincost=cost; for (i=0;i<N;i++) temp[i]:task[i]; } else{ for(i=0;i<N;i++) /*分配任务k*/ if (worker[i]=0&&(2)){ worker[i]=1; task[k]=(3); Plan((4),cost+c[k][i]); (5); task[k]=0; }/*if*/ } }/*Plan*/ void main() {int i,j; for (i=0;i<N;i++) { /*设置每个任务由不同工人承担时的费用及全局数组的初值*/ worker[i]=0;task[i]=0; temp[i]=0; for(j=0;j<N;j++) scanf ('%d',&c[i][j]); } Plan (0,0); /*从任务0开始分配*/ printf('/n最小费用=%d/n',mincost); for(i二0;i<N;i++) pnntf('Task%d iB assigned toWorker%d/n',i,temp[i]); }/*main*/
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【简答题】(案例)患者女,39岁。突发剧烈头痛半个月,伴意识障碍,右侧肢体活动障碍1周住院。既往无高血压病史。半个月前与家人聊天时突感剧烈头痛,呈持续胀痛,不能忍受,急到当地医院,测血压为200/100mmHg。半小时后出现意识丧失,肢体强直抽搐,口吐白沫,持续约10分钟自行缓解。急诊头颅CT检查示颅内出血,腰穿检查抽出血性脑脊液。给予药物治疗,头痛缓解。1周后患者出现昏睡,表情淡漠,不能言语,同时出现右侧...
【单选题】( )有着十分重要的表达情感的作用,被称为“情感的睛雨表”。
A.
语气
B.
语速
C.
语感
D.
语调
【单选题】蛛网膜下腔出血患者最突出的表现是
A.
剧烈头痛
B.
恶心,呕吐
C.
烦躁不安
D.
意识改变
【单选题】手足口病的发病人群主要是:( )
A.
成人
B.
5 岁以下儿童
C.
学龄儿童
D.
人群普遍易感
【简答题】The engineer put forward a (suggest) ________ at the meeting to improve the public traffic system.
【单选题】When the engineer room is put in standby condition, the engineer in charge of the watch needs not to _______.
A.
ensure all machinery which may be used during maneuvering is in ready
B.
ensure adequate reserve of power is available for steering gear and other requirements
C.
keep the main propulsion unit controls continuously attended when in manual mode of operation
D.
ensure all machinery which may be used during maneuvering is running stably
【判断题】排解愤怒是不需要讲究技巧的,只要图一时之快,逞一时之勇,发泄出来就好。
A.
正确
B.
错误
【多选题】Which topics in the following choices have been studied by Fyodor Dostoevsky?
A.
faith
B.
morality
C.
psychological study
【简答题】Read the passage and decide which paragraph talks about each of the topics in the box below.
【单选题】The engineer put forward a__________proposal.
A.
concrete
B.
constant
相关题目: