0,weightTotalTimeSum=0;Р sort(p);Р for(int m=0;m<N-1;m++)Р {Р if(m==0)Р p[m].finishTime=p[m].arriveTime+p[m].runTime;Р elseР p[m].finishTime=p[m-1].finishTime+p[m].runTime;Р int i=0;Р for(int n=m+1;n<=N-1;n++)Р { Р if(p[n].arriveTime<=p[m].finishTime)Р i++;Р }Р float max=(p[m].finishTime-p[m+1].arriveTime)/p[m+1].runTime;Р int follow=m+1;Р for(int k=m+1;k<m+i;k++)Р { Рif(max<=(p[m].finishTime-p[k+1].arriveTime)/p[k+1].runTime){ max=(p[m].finishTime-p[k+1].arriveTime)/p[k+1].runTime;Р follow=k+1;Р }Р }Р time temp;Р temp=p[m+1];Р p[m+1]=p[follow];Р p[follow]=temp;Р }Р deal(p,totalTimeSum,weightTotalTimeSum);Р cout<<"最高响应比优先:"<<endl;Р Print(p,totalTimeSum,weightTotalTimeSum);Р}//最高响应比优先算法,p标识进程Рvoid main(){Р time a[N];Р InputTime(a);Р time *b=a;time *c=a;Р FCFS(a);Р SWF(b);Р TRRF(c);Р}Р五、运行结果