教程集训队作业0022-visit_第1页
教程集训队作业0022-visit_第2页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、题目0022)题目来源:Balkan璟TheOneconsultingofficeanizedas All the ntsare in a queue and the done isaccording to this queue,it out. The consultant for a nt is determined according to der of the previous nt, male (M)题目0022)题目来源:Balkan璟TheOneconsultingofficeanizedas All the ntsare in a queue and the done isacc

2、ording to this queue,it out. The consultant for a nt is determined according to der of the previous nt, male (M) or female (F). For instance, the consultant Ci (i=1,2,.,N), (2N=40) which receives nt, consults the nt and according to the his/her gender directs the next nt to if the present nt is male

3、, or to consultant Ck if the present nt is female. Thus, this consultantthenextOne clever nt has t in a case it sible to be in a tregardless of the consultantt begins the consulting, this nt to be treated by a Youhave towrite a queuewhichendswiththist discovers if this sible and if so, to find the m

4、inimal ntandtheconsultant,which willconsultthisOnthecontrary,ifsuchaqueuedoesnotexist,yourprogramwillwritethemessage:The ltconducttheconsultingarerepresentedegers Input text file contains this office.line eger N, the number of consultants he Nfollowinglines,are egersper line. egerrepresents theconsu

5、ltantis consulting, the eger is the consultant who continues he case when nt being consulted was a female whereas the egerrepresentsthe consultantwillcontinueconsultingifthentbeingconsultedwase male Outputtextfilewillhreelinesifsucha queueexists,oronelineifIn the case this queue exists line of the f

6、ile will contains the length of the queue, second line a string of characters theconsultantwhowillconsultthet represents the queue, the third line Insecond line a string of characters theconsultantwhowillconsultthet represents the queue, the third line Incasethisqueueissible,theoutputfilevisit.outwi

7、llhaveonelinewithstringleInput5123452421341345OutputFile 4leInput43Output) Cj处(male)Ck 处(female)Cm。sible输入文件第一行有一个正整数N,顾问的数目。 N行里,每行三个整数。第一个是顾问的female。 4513454输入文件第一行有一个正整数N,顾问的数目。 N行里,每行三个整数。第一个是顾问的female。 451345443: 化化 1,则找到最优解。但是搜索量无法估计。:240次方,而且加一些剪枝,感觉应。Fi,Mii。gf(k,i,jtrue表示存在队列S1)S1 =2)S 易知,gf

8、(k,i,jgf(k-1,Fi,Fj)gm(k-1,Fi,Fj)或者gf(k-) = 索判断是否已经找到合法队列了,判断过程由Search()完成,伪代码如下:U=(x,y);x,y1.n; ;ProcedureSearch(Ukstrk0 str、结束所有程序; f = true,m = true;Fori=1 nFor j = i + 1 n do If(i,j)UThengf(k,i,j) = false Then f = false; gm(k,i,j)=falseThenm=false;End End End Iff=trueV= Fori=1nFor j=i+End Iff=trueV= Fori=1nFor j=i+1 nUThenV=V+ End ifIfm=trueV= Fori=1nFor j=i+1 nUThenV=V+ End ifEnd 当然,如果某时出现gf(k,i,j) = gf(k-1,i,j)并且(k,i,j) = gm(k-1,i,j)k2:12更像过程Search()如果集合a1am中的每个人可以通过一个开头顾Female 2 DFS,如

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论