下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、0017(魔术题目来源:IPSC 2001 Problem H昆一、英文A ianentersthestage,followedbyabeautifulassistant.Hehisshowbypullingseveralharesfromhat,thenhefindsabouquet heassistants0017(魔术题目来源:IPSC 2001 Problem H昆一、英文A ianentersthestage,followedbyabeautifulassistant.Hehisshowbypullingseveralharesfromhat,thenhefindsabouquet
2、heassistantsscarf,andfinallyhelockstheassistantinaemptymirrorbox.Andthencomestheturn.ianshowsteercomestoadeckofNcards (allthecardsaredifferent, Nisodd).Astageandselects(N+1)/2cards.Therestofthecardsislostianshat.Afterwavinghishandsabovetheselectedcards,picksuponeofthecardsandgives ittothe teerwhosho
3、ws ittoaudience and subsequently hides it in his pocket. The assistant, after being releasedfromthemirrorbox,comestothedeckoftheremaining(N+1)/2-1cards.ShewavesherhandsaboveitforawhileandthenshedescribesthecardheteersHowcouldthis?Aclevertrick?GivenN,gorithm(ifexists)forianandhis1. Istheassistantanex
4、traterrestrialorsomeonesheisanormal,albeitbeautiful,humanepathy?2. Howdidtheassistantgetoutofthemirrorbox?,of3. Cantheassistantseethroughthemirrorboxorpockets?ObviouslyseeanswertoQ.InputfileGivenisoddN,thenumberofOutputfileLets tthecardsarenumberedheoutputfile,listsiblesubsetsof1,2,.,Nofsize(N+1)/2I
5、nputfileGivenisoddN,thenumberofOutputfileLets tthecardsarenumberedheoutputfile,listsiblesubsetsof1,2,.,Nofsize(N+1)/2,everysubsetonaEverysubset Sisfollowedby-andbyanumber cfromS.Thenumberctheonet ianshouldgivetotheteer.Thisdescribesiansalgorithm.Thestobeabletofindtheuniquec,seeingthesetS-c.Therefore
6、,innotwolines S-ccanbethesame.Ifholds,assistantcanusetheiansalgorithmtoidentifycorrectc.(Bothofthemhavetomemorizeyouroutputfile.)EveryconsecutivenumbersinS,thenumbercand-areseparatedbysingle.Ifnoalgorithmexists,outputasinglewordInput3Outputfile(oneoutofseveral 1 2 - 213- 23- 二、中文题魔n(每张牌都不同,n)。一个依靠魔法
7、输入文件输出文件假设牌按 ,在输出文件中,列出所有大小依靠魔法输入文件输出文件假设牌按 ,在输出文件中,列出所有大小为(n+1)/2 的子集合,每一个集s 后面是一个“-”和一个数 c。c 是魔术师抽出来给观众看得那张牌。按照你的描述样例输入3样例输出:(有多种方案只要输出一种12 -13 -23 -三、初情周源出构造算法就更好 :邵烜程A1,A2,表示1,2,n的所有大小为(n+1)/2的子集合,B1,B2,表示1,2,n的所有大小为(n-1)/2的子集合,AIBj有边相连当且仅当集合 AI 去掉某个元素后恰好变成 Bj,求出此二分图的完备匹配就可以了。: mod璟: mod璟a1a2amc
8、=aii=(a1+a2+am) mod m:A1,A2Akj=(A1+A2+Ak)mod(n+1)/2)(j=0时j取Aj昆做法:设 m=(n+1)/2,某一次选的 m 个数是 a1,a2,.,am那么这些数中的第(a1+a2+.+am)modm+1 个数去掉。,a1a2am,b1b2bm, 根据条件,j-i=(bj-ai)mod bjaiji+m, 林希德令 m = (n+1)/2M张牌是S0、S1、S2 Sm-1。xSmodi 1(B0B11(B0B1i(mod i j (mod m)AiBjijAiBjijmi,2)AiBjijm,那么因为(m1i)+(j) (nAi)+ (Bj1)Ai Bj nijm1 + ij:对于任意一个(n+1)/2 元的子集,将其元素从大至小排列,A0,A1,A(n+1)/2-1,记 ) (mod (n+1)/2,而另一个不同的子集 B0,B1,B(n+1)/2-1,记 q= (B0+B1+B(n+1)/2-1) ,不妨设 设 s=(A0+
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024-2029年中国冻鱼片行业市场发展分析及发展趋势与投资研究报告
- 浅论如何提升中小学生的创意表达
- 中级经济师《中级人力资源管理》复习题集(第4559篇)
- 辛集市佳美水泥制品厂新建年产25万块水泥地砖、10万块路牙石、4000立方 水泥化粪池预制件项目环境影响报告表
- 餐饮店面业绩提升方案(2篇)
- 教师节给老师感谢信
- 物流运输方案优化研究(2篇)
- 常见问题及解决方案分析(2篇)
- 如何提高员工安全意识
- 家庭纺织品的生产工艺与技术创新
- 相变蓄热球体堆积床传热模型及热性能分析
- 胃积病(胃癌)中医诊疗方案分析、总结、评估报告
- 国家级文明旅游示范单位申请评定报告书(自评报告)
- 电磁场与电磁波完整版课件全套PPT教程最全电子教案
- 香港与内地报表转换
- 民营整形医院与公立整形医院的区别
- 临时板房施工组织设计
- 最新北师大版六年级数学下册期中测试卷含答案
- 国家开放大学《数据结构(本)》单元测试参考答案
- 国家开放大学《土木工程力学(本)》形考作业1-5参考答案
- GB 13544-2011 烧结多孔砖和多孔砌块.pdf
评论
0/150
提交评论