A.SoldierandBananas模拟[crayon-6767f25a69d73456263637/]B.SoldierandBadges排序[crayon-6767f25a69d80839986658/]C.SoldierandCards暴力模拟个一百万次。。。[crayon-6767f25a69d88091296910/]D.SoldierandNumberGame用筛法得出每个数质因子个数前缀和即可[crayon-6767f25a69d8f226242906/]E.SoldierandTraveling我比较愚蠢写了网络流。。正解是什么我不知道[crayon-6767f25a69d98821434464/] ...
DescriptionBeadsofNcolorsareconnectedtogetherintoacircularnecklaceofNbeads(N<=1000000000).Yourjobistocalculatehowmanydifferentkindsofthenecklacecanbeproduced.YoushouldknowthatthenecklacemightnotuseupalltheNcolors,andtherepetitionsthatareproducedbyrotationaroundthecenterofthecircularnecklaceareallneglected.YouonlyneedtooutputtheanswermoduleagivennumberP.InputThefirstlineoftheinputisa...
DescriptionChinesepeoplethinkof'8'astheluckydigit.Bobalsolikesdigit'8'.Moreover,BobhashisownluckynumberL.NowhewantstoconstructhisluckiestnumberwhichistheminimumamongallpositiveintegersthatareamultipleofLandconsistofonlydigit'8'.InputTheinputconsistsofmultipletestcases.EachtestcasecontainsexactlyonelinecontainingL(1≤L≤2,000,000,000).Thelasttestcaseisfollowedbyalinecontainingazero.O...
DescriptionWesaythatintegerx,0<x<p,isaprimitiverootmodulooddprimepifandonlyiftheset{(ximodp)|1<=i<=p-1}isequalto{1,...,p-1}.Forexample,theconsecutivepowersof3modulo7are3,2,6,4,5,1,andthus3isaprimitiverootmodulo7.Writeaprogramwhichgivenanyoddprime3<=p<65536outputsthenumberofprimitiverootsmodulop.InputEachlineoftheinputcontainsanoddprimenumbersp.Inputisterminatedbytheend-of-...
近期评论