IEE极限编程预赛题目

IEE极限编程预赛题目

ID:38582656

大小:276.50 KB

页数:21页

时间:2019-06-15

IEE极限编程预赛题目_第1页
IEE极限编程预赛题目_第2页
IEE极限编程预赛题目_第3页
IEE极限编程预赛题目_第4页
IEE极限编程预赛题目_第5页
资源描述:

《IEE极限编程预赛题目》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、Language:1246HilbertCurveIntersectionsTimeLimit: 1000MSMemoryLimit: 10000KTotalSubmissions: 171Accepted: 58DescriptionDavidHilbertprovedtheexistenceofaverycounter-intuitivecurvethatfillsspace.TheconstructionoftheHilbertcurveisbasedonasequenceofcurves,H1,H2,H3,H4,...composedofhor

2、izontalandverticalsegments.Eachcurveliesintheunitsquare[0,1]*[0,1].H1containsjustthreesegments,connectingthepoints(1/4,3/4)to(1/4,1/4)to(3/4,1/4)to(3/4,3/4).Hn isdefinedrecursivelyintermsofHn-1,forn=2,3,...byfourtransformations: 1.HalveallcoordinatesinHn-1. 2.Addacopyrotated90de

3、greescounterclockwiseaboutthepoint(0,1/2). 3.Addthereflectionacrossthelinex=1/2. 4.Letm=1/2n+1.Addsegmentsconnectingendpoints(1/2-m,1/2-m)to(1/2+m,1/2-m),(m,1/2-m)to(m,1/2+m),and(1-m,1/2-m)to(1-m,1/2+m). Yourjobistocountthenumberofintersectionsofhorizontallinesegmentswiththesecu

4、rves.Forexample,considerFigures1and2,whichillustratethefirsttwoexampleinputdatasetsbelow. ThecoordinatesofverticesofHnareoddmultiplesof1/2n+1.Thecoordinatesofhorizontalsegmentendpointswillalwaysbemultiplesof1/2n.HencethespecifiedhorizontalsegmentcanonlycrossverticalsegmentsinHn.

5、 InputInputconsistsofoneto100datasets,oneperline,followedbyafinallinecontainingonly0.Eachdatasetconsistsoffourintegersseparatedbyblanksintheform nx1x2y whichrepresentsHn andthesegmentfrom(x1/2n,y/2n)to(x2/2n,y/2n),where0

6、. OutputTheoutputisoneintegerperlineforeachdataset:thenumberofintersectionsofHn withthesegment.Caution:Abruteforcesolutionthatcomputeseachintersectionindividuallywillnotfinishwithintheoneminutetimelimit.Asyoucanseebelow,theremaybemorethanonebillionintersectionsforanydataset. Sam

7、pleInput3277 40161 30110737418231 0SampleOutput3 16 1073741822SourceMid-CentralUSA20023766HexagonCoinTossTimeLimit: 1000MSMemoryLimit: 65536KTotalSubmissions: 378Accepted: 113DescriptionHexagonCoinTossisasimplegameplayedonaHexagonchessboard.Playerstossacoinonthechessboardandseeh

8、owmanyhexagonsintersectwiththecoin.Nowyouaregiv

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

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

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