• 「BZOJ2141」排队

    「BZOJ2141」排队

    Description排排坐,吃果果,生果甜嗦嗦,大家笑呵呵。你一个,我一个,大的分给你,小的留给我,吃完果果唱支歌,大家乐和和。红星幼儿园的小朋友们排起了长长地队伍,准备吃果果。不过因为小朋友们的身高有所区别,排成的队伍高低错乱,极不美观。设第i个小朋友的身高为hi,我们定义一个序列的杂乱程度为:满足ihj的(i,j)数量。幼儿园阿姨每次会选出两个小朋友,交换他们的位置,请你帮忙计算出每次交换后,序列的杂乱程度。为方...

    42014年7月26日18,238分块
  • 「BZOJ2201」彩色圆环

    「BZOJ2201」彩色圆环

    DescriptionInput仅有一行,该行给出依次两个正整数N,M,分别表示宝石的个数和宝石在变化时可能变成的颜色种类数。Output应仅有一行,该行给出一个实数E(R),表示圆环的“美观程度”的期望值。SampleInput81SampleOutput8.00000「数据规模和约定」100%的数据满足1≤N≤200,1≤M≤10^9。题解dp[i][j]表示前i个珠子,最后一个珠子和第一个是否相同(0,1)的期望值这样可以 比较容易地 得到一个n^2的转移p[i]表示i个珠子...

    02014年7月25日3,680递推与动规
  • 「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,479递推与动规
  • 「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,754排列组合,乘法逆元,容斥原理
  • 「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,495递推与动规
  • 「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,241模拟
  • 「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,670模拟
  • 「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,524博弈论
  • 「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日3,012递推与动规
  • 「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,780模拟,线段树
  • 「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,521其它
  • 「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,214深度搜索
76 / 144 « 上一页 1 ...74 75 76 77 78 ...144 下一页 »