付费下载
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 贝雕工安全专项知识考核试卷含答案
- 水禽饲养员岗前核心能力考核试卷含答案
- 文化经纪人跨界整合考核试卷含答案
- 沥青装置操作工岗位环保责任制强化考核试卷含答案
- 汽车车身涂装修复工岗位应变水平考核试卷含答案
- 啤酒糖化工激励强化考核试卷含答案
- 2026年经济开发区博物馆布展方案
- 年度森林防火工作总结
- 麻醉药品和精神药品管理条例培训试卷及答案
- 机场项目曳引式电梯安装施工方案
- 可上传班级管理(一到三章)李学农主编
- 浙江省中小学心理健康教育课程标准
- DL-T5169-2013水工混凝土钢筋施工规范
- 日立中央空调VAMII设计培训手册
- 彩色多普勒超声诊断仪投标方案(技术标)
- 2019版《压力性损伤的预防和治疗:临床实践指南》解读
- 社区工作考试公共基础知识试题及答案
- 北京市行政处罚案卷标准和评查评分细则
- Python商务数据分析与实战PPT完整全套教学课件
- 冠心病健康教育知识讲座总结
- 中山大学高等数学期末考试试卷(含答案)
评论
0/150
提交评论