Vanyadecidedtowalkinthefieldofsizen × ncells.Thefieldcontainsmappletrees,thei-thappletreeisatthecellwithcoordinates(xi, yi).Vanyamovestowardsvector(dx, dy).ThatmeansthatifVanyaisnowatthecell(x, y),theninasecondhewillbeatcell.Thefollowingconditionissatisfiedforthevector:,whereisthelargestintegerthatdividesbothaandb.Vanyaendshispathwhenhereachesthesquarehehasalreadyvisited.Vanyawonders...
VanyaandhisfriendVovaplayacomputergamewheretheyneedtodestroynmonsterstopassalevel.Vanya'scharacterperformsattackwithfrequencyxhitspersecondandVova'scharacterperformsattackwithfrequencyyhitspersecond.Eachcharacterspendsfixedtimetoraiseaweaponandthenhehits(thetimetoraisetheweaponis1 / xsecondsforthefirstcharacterand1 / ysecondsforthesecondone).Thei-thmonsterdiesafterhereceivesaihits.Vanya...
Vanyawantstopassnexamsandgettheacademicscholarship.Hewillgetthescholarshipiftheaveragegrademarkforalltheexamsisatleastavg.Theexamgradecannotexceedr.Vanyahaspassedtheexamsandgotgradeaiforthei-thexam.Toincreasethegradeforthei-thexamby1point,Vanyamustwritebiessays.Hecanraisetheexamgrademultipletimes.WhatistheminimumnumberofessaysthatVanyaneedstowritetogetscholarship?InputThefirstlinecontai...
Vanyawalkslateatnightalongastraightstreetoflengthl,litbynlanterns.Considerthecoordinatesystemwiththebeginningofthestreetcorrespondingtothepoint0,anditsendcorrespondingtothepointl.Thenthei-thlanternisatthepointai.Thelanternlightsallpointsofthestreetthatareatthedistanceofatmostdfromit,wheredissomepositivenumber,commonforalllanterns.Vanyawonders:whatistheminimumlightradiusdshouldthelanternshavet...
Vanyagotncubes.Hedecidedtobuildapyramidfromthem.Vanyawantstobuildthepyramidasfollows:thetoplevelofthepyramidmustconsistof1cube,thesecondlevelmustconsistof1 + 2 = 3cubes,thethirdlevelmusthave1 + 2 + 3 = 6cubes,andsoon.Thus,thei-thlevelofthepyramidmusthave1 + 2 + ... + (i - 1) + icubes.Vanyawantstoknowwhatisthemaximumheightofthepyramidthathecanmakeusingthegivencubes.InputT...
近期评论