算法分析与设计-大型实验报告样本

算法分析与设计-大型实验报告样本

ID:18844842

大小:135.50 KB

页数:12页

时间:2018-09-26

算法分析与设计-大型实验报告样本_第1页
算法分析与设计-大型实验报告样本_第2页
算法分析与设计-大型实验报告样本_第3页
算法分析与设计-大型实验报告样本_第4页
算法分析与设计-大型实验报告样本_第5页
资源描述:

《算法分析与设计-大型实验报告样本》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、算法分析大型实验报告编号标题算法题目一1005Jugs模拟题目二1007DotheUntwist字符串班级:姓名:学号:指导老师:2011年8月ZJUT-1005Jugs浙江大学,TuringCup2001,http://acm.zju.edu.cn/show_problem.php?pid=1005SpecialJudgeTimelimit:1SecondsMemorylimit:32768KInthemovie"DieHard3",BruceWillisandSamuelL.Jacksonwereconfrontedwiththefollowingpuzzle.Theywer

2、egivena3-gallonjuganda5-gallonjugandwereaskedtofillthe5-gallonjugwithexactly4gallons.Thisproblemgeneralizesthatpuzzle.Youhavetwojugs,AandB,andaninfinitesupplyofwater.Therearethreetypesofactionsthatyoucanuse:(1)youcanfillajug,(2)youcanemptyajug,and(3)youcanpourfromonejugtotheother.Pouringfromo

3、nejugtotheotherstopswhenthefirstjugisemptyorthesecondjugisfull,whichevercomesfirst.Forexample,ifAhas5gallonsandBhas6gallonsandacapacityof8,thenpouringfromAtoBleavesBfulland3gallonsinA.Aproblemisgivenbyatriple(Ca,Cb,N),whereCaandCbarethecapacitiesofthejugsAandB,respectively,andNisthegoal.Asolu

4、tionisasequenceofstepsthatleavesexactlyNgallonsinjugB.ThepossiblestepsarefillAfillBemptyAemptyBpourABpourBAsuccesswhere"pourAB"means"pourthecontentsofjugAintojugB",and"success"meansthatthegoalhasbeenaccomplished.Youmayassumethattheinputyouaregivendoeshaveasolution.InputInputtoyourprogramconsi

5、stsofaseriesofinputlineseachdefiningonepuzzle.Inputforeachpuzzleisasinglelineofthreepositiveintegers:Ca,Cb,andN.CaandCbarethecapacitiesofjugsAandB,andNisthegoal.Youcanassume0

6、ctionsfromthelistofthepotentialoutputlineswhichwillresultineitherofthejugscontainingexactlyNgallonsofwater.Thelastlineofoutputforeachpuzzleshouldbetheline"success".Outputlinesstartincolumn1andthereshouldbenoemptylinesnoranytrailingspaces.SampleInput354573SampleOutputfillBpourBAemptyApourBAfil

7、lBpourBAsuccessfillApourABfillApourABemptyBpourABsuccess【全文翻译】在电影“虎胆龙威3-纽约大劫案”中,布鲁斯·威利斯和杰里米·艾恩斯遇到这样一个难题:给他们一个3加仑水壶和一个5加仑水壶,要求在5加仑水壶里准确装入4加仑的水。真是个难题呢。假定两个水壶A和B,供水量不限。可以使用三种方法装水:(1)给一个水壶装水;(2)把一个水壶倒空;(3)从一个水壶倒进另一个水壶。当从一个水壶倒进另一个水壶时,如果第一个水壶倒空,或者第

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。