DescriptionArcheologistsfromtheAntiquitiesandCuriosMuseum(ACM)haveflowntoEgypttoexaminethegreatpyramidofKey-Ops.Usingstate-of-the-arttechnologytheyareabletodeterminethatthelowerfloorofthepyramidisconstructedfromaseriesofstraightlinewalls,whichintersecttoformnumerousenclosedchambers.Currently,nodoorsexisttoallowaccesstoanychamber.Thisstate-of-the-arttechnologyhasalsopinpointedthelocat...
DescriptionYouaretofindthelengthoftheshortestpaththroughachambercontainingobstructingwalls.Thechamberwillalwayshavesidesatx=0,x=10,y=0,andy=10.Theinitialandfinalpointsofthepatharealways(0,5)and(10,5).Therewillalsobefrom0to18verticalwallsinsidethechamber,eachwithtwodoorways.Thefigurebelowillustratessuchachamberandalsoshowsthepathofminimallength.InputTheinputdatafortheillustratedchamberwould...
DescriptionStanhasnsticksofvariouslength.Hethrowsthemoneatatimeonthefloorinarandomway.Afterfinishingthrowing,Stantriestofindthetopsticks,thatisthesestickssuchthatthereisnostickontopofthem.Stanhasnoticedthatthelastthrownstickisalwaysontopbuthewantstoknowallthesticksthatareontop.Stansticksarevery,verythinsuchthattheirthicknesscanbeneglected.InputInputconsistsofanumberofcases.Thedataforeach...
DescriptionWeallknowthatapairofdistinctpointsonaplanedefinesalineandthatapairoflinesonaplanewillintersectinoneofthreeways:1)nointersectionbecausetheyareparallel,2)intersectinalinebecausetheyareontopofoneanother(i.e.theyarethesameline),3)intersectinapoint.Inthisproblemyouwilluseyouralgebraicknowledgetocreateaprogramthatdetermineshowandwheretwolinesintersect.Yourprogramwillrepeatedlyreadinfourpo...
DescriptionGiven n segmentsinthetwodimensionalspace,writeaprogram,whichdeterminesifthereexistsalinesuchthatafterprojectingthesesegmentsonit,allprojectedsegmentshaveatleastonepointincommon.InputInputbeginswithanumber T showingthenumberoftestcasesandthen, T testcasesfollow.Eachtestcasebeginswithalinecontainingapositiveinteger n ≤100showingthenumberofsegments.Afterthat,n linescontai...
DescriptionMomanddadhaveaproblem:theirchild,Reza,neverputshistoysawaywhenheisfinishedplayingwiththem.TheygaveRezaarectangularboxtoputhistoysin.Unfortunately,Rezaisrebelliousandobeyshisparentsbysimplythrowinghistoysintothebox.Allthetoysgetmixedup,anditisimpossibleforRezatofindhisfavoritetoysanymore.Reza'sparentscameupwiththefollowingidea.Theyputcardboardpartitionsintothebox.EvenifRezak...
DescriptionCalculatethenumberoftoysthatlandineachbinofapartitionedtoybox.Momanddadhaveaproblem-theirchildJohnneverputshistoysawaywhenheisfinishedplayingwiththem.TheygaveJohnarectangularboxtoputhistoysin,butJohnisrebelliousandobeyshisparentsbysimplythrowinghistoysintothebox.Allthetoysgetmixedup,anditisimpossibleforJohntofindhisfavoritetoys. John'sparentscameupwiththefollowingidea.Th...
近期评论