付费下载
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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 幼儿情绪管理沉着情绪应急处理课件
- 溃疡性口腔炎症状分析及护理建议
- 小学数学计算能力训练
- 眼科青光眼手术后眼压监测流程
- 下肢动脉硬化科普
- 会计纺织科学就业分析
- 宁德时代Ener D 液冷集装箱(20 尺)产品规格书
- 四川省2025年高职单招职业技能综合测试(中职类)电子信息类试卷
- 商务司机岗位职责与考核标准
- 中小学实验教学基本目录(2023 年版)
- 河北省2025年机关事业单位经济民警技师考试题库(附答案+解析)
- 上海市2025上海申康医疗卫生建设工程公共服务中心工作人员招聘1人笔试历年参考题库附带答案详解
- 2025年湖北省农村义务教育学校教师公开招聘小学语文真题(附答案)
- DBJ46-048-2018 海南省建筑工程防水技术标准
- 客服基础考试试题及答案
- 全自动压捆机安全操作规程
- 抽水蓄能电站下水库工程砌体工程施工方案
评论
0/150
提交评论