• 「BZOJ1649」[Usaco2006 Dec] Cow Roller Coaster

    「BZOJ1649」[Usaco2006 Dec] Cow Roller Coaster

    DescriptionThecowsarebuildingarollercoaster!Theywantyourhelptodesignasfunarollercoasteraspossible,whilekeepingtothebudget.TherollercoasterwillbebuiltonalonglinearstretchoflandoflengthL(1<=L<=1,000).TherollercoastercomprisesacollectionofsomeoftheN(1<=N<=10,000)differentinterchangablecomponents.EachcomponentihasafixedlengthWi(1<=Wi<=L).Duetovaryingterrain,eachcomponen...

    02014年7月25日2,389递推与动规
  • 「CF451E」Devu and Flowers

    「CF451E」Devu and Flowers

    Devuwantstodecoratehisgardenwithflowers.Hehaspurchased n boxes,wherethe i-thboxcontains fi flowers.Allflowersinasingleboxareofthesamecolor(hencetheyareindistinguishable).Also,notwoboxeshaveflowersofthesamecolor.NowDevuwantstoselect exactly s flowersfromtheboxestodecoratehisgarden.Devuwouldliketoknow,inhowmanydifferentwayscanheselecttheflowersfromeachbox?Sincethisnumbermaybeverylarg...

    12014年7月25日6,472排列组合,乘法逆元,容斥原理
  • 「CF451D」Count Good Substrings

    「CF451D」Count Good Substrings

    Wecallastring good,ifaftermergingalltheconsecutiveequalcharacters,theresultingstringispalindrome.Forexample,"aabba"isgood,becauseafterthemergingstepitwillbecome"aba".Givenastring,youhavetofindtwovalues:thenumberofgoodsubstringsofevenlength;thenumberofgoodsubstringsofoddlength.InputThefirstlineoftheinputcontainsasinglestringoflength n (1 ≤ n ≤ 105).Eachcharacterofthestringwillbeeithe...

    02014年7月25日2,403递推与动规
  • 「CF451C」Predict Outcome of the Game

    「CF451C」Predict Outcome of the Game

    Thereare n gamesinafootballtournament.Threeteamsareparticipatinginit.Currently k gameshadalreadybeenplayed.Youareanavidfootballfan,butrecentlyyoumissedthewhole k games.Fortunately,yourememberaguessofyourfriendforthese kgames.Yourfrienddidnottellexactnumberofwinsofeachteam,insteadhethoughtthatabsolutedifferencebetweennumberofwinsoffirstandsecondteamwillbe d1 andthatofbetweensecondand...

    02014年7月25日3,166模拟
  • 「CF451B」 Sort the Array

    「CF451B」 Sort the Array

    Beingaprogrammer,youlikearraysalot.Foryourbirthday,yourfriendshavegivenyouanarray a consistingof n distinct integers.Unfortunately,thesizeof a istoosmall.Youwantabiggerarray!Yourfriendsagreetogiveyouabiggerarray,butonlyifyouareabletoanswerthefollowingquestioncorrectly:isitpossibletosortthearray a (inincreasingorder)byreversing exactlyone segmentof a?Seedefinitionsofsegmentandreve...

    02014年7月25日2,598模拟
  • 「CF451A」Game With Sticks

    「CF451A」Game With Sticks

    AfterwinninggoldandsilverinIOI2014,AkshatandMalvikawanttohavesomefun.Nowtheyareplayingagameonagridmadeof nhorizontaland m verticalsticks.An intersectionpoint isanypointonthegridwhichisformedbytheintersectionofonehorizontalstickandoneverticalstick.Inthegridshownbelow, n = 3 and m = 3.Thereare n + m = 6 sticksintotal(horizontalsticksareshowninredandverticalsticksareshowni...

    02014年7月25日3,389博弈论
  • 「BZOJ1633」[Usaco2007 Feb] The Cow Lexicon 牛的词典

    「BZOJ1633」[Usaco2007 Feb] The Cow Lexicon 牛的词典

    Description没有几个人知道,奶牛有她们自己的字典,里面的有W(1≤W≤600)个词,每个词的长度不超过25,且由小写字母组成.她们在交流时,由于各种原因,用词总是不那么准确.比如,贝茜听到有人对她说"browndcodw",确切的意思是"browncow",多出了两个"d",这两个"d"大概是身边的噪音.奶牛们发觉辨认那些奇怪的信息很费劲,所以她们就想让你帮忙辨认一条收到的消息,即一个只包含小写字母且长度为L(2≤L≤300)的字符串.有些时候,这个字符串...

    02014年7月24日2,918递推与动规
  • 「BZOJ3702」「FJ互测」二叉树

    「BZOJ3702」「FJ互测」二叉树

    Description(tree.c/.cpp/.pas)现在有一棵二叉树,所有非叶子节点都有两个孩子。在每个叶子节点上有一个权值(有n个叶子节点,满足这些权值为1..n的一个排列)。可以任意交换每个非叶子节点的左右孩子。要求进行一系列交换,使得最终所有叶子节点的权值按照中序遍历写出来,逆序对个数最少。InputFormat(tree.in)第一行n下面每行,一个数x如果x==0,表示这个节点非叶子节点,递归地向下读入其左孩子和右孩子的信息,如果x!=0,表示...

    12014年7月24日4,668模拟,线段树
  • 「BZOJ1011」[HNOI2008] 遥远的行星

    「BZOJ1011」[HNOI2008] 遥远的行星

    Description直线上N颗行星,X=i处有行星i,行星J受到行星I的作用力,当且仅当i<=AJ.此时J受到作用力的大小为Fi->j=Mi*Mj/(j-i)其中A为很小的常量,故直观上说每颗行星都只受到距离遥远的行星的作用。请计算每颗行星的受力,只要结果的相对误差不超过5%即可.Input第一行两个整数N和A.1<=N<=10^5.0.01<a<=0.35接下来N行输入N个行星的质量Mi,保证0<=Mi<=10^7OutputN行,依次输出各行星的...

    02014年7月24日5,244其它
  • 「BZOJ1653」[Usaco2006 Feb] Backward Digit Sums

    「BZOJ1653」[Usaco2006 Feb] Backward Digit Sums

    DescriptionFJandhiscowsenjoyplayingamentalgame.Theywritedownthenumbersfrom1toN(1<=N<=10)inacertainorderandthensumadjacentnumberstoproduceanewlistwithonefewernumber.Theyrepeatthisuntilonlyasinglenumberisleft.Forexample,oneinstanceofthegame(whenN=4)mightgolikethis:31244367916BehindFJ'sback,thecowshavestartedplayingamoredifficultgame,inwhichtheytrytodeterminethestartingsequencefromo...

    02014年7月24日3,139深度搜索
  • 「BZOJ1643」[Usaco2007 Oct] Bessie’s Secret Pasture 贝茜的秘密草坪

    「BZOJ1643」[Usaco2007 Oct] Bessie's Secret Pasture 贝茜的秘密草坪

    Description农夫约翰已经从他的牧场中取得了数不清块数的正方形草皮,草皮的边长总是整数(有时农夫约翰割草皮的刀法不合适,甚至切出了边长为0的正方形草皮),他已经把草皮放在了一个奶牛贝茜已经知道的地方。贝茜总是希望把美味的草皮放到她的秘密庄园里,她决定从这些草皮中取出恰好4块搬到她的秘密庄园中,然后把它们分成1×1的小块,组成一个面积为N(1<=N<=10,000)个单位面积的部分。贝茜对选出这样四块草皮的方法数...

    02014年7月24日2,495递推与动规
  • 「BZOJ3693」「FJ2014集训」圆桌会议

    「BZOJ3693」「FJ2014集训」圆桌会议

    问题描述有n组人要一起开一个圆桌会议(编号为0~n-1),会议的圆桌上有m个位置(编号为0~m-1)。每个组有ai个人,他们需要被安排在(li,(li+1)%m,(li+2)%m,…,ri)的座位范围内。每个座位只能安排一个人就坐,并且每个人都需要被安排一个座位。现在你需要判断是否存在满足条件的座位安排。输入格式输入包含不超过10组数据。第一行有一个数字T,表示数据组数。接下来有T组数据,每组数据第一行包含两个数n,m,表示有多少组的...

    02014年7月23日5,173线段树
77 / 145 « 上一页 1 ...75 76 77 78 79 ...145 下一页 »