[hdu7085]Pty loves SegmentTree】的更多相关文章

简单分析,不难得到以下转移--$$f_{n}=\begin{cases}1&(n=1)\\B\sum_{i=1}^{n-1}f_{i}f_{n-i}&(n\le k)\\B\sum_{i=1}^{n-1}f_{i}f_{n-i}+(A-B)f_{k}f_{n-k}&(n>k)\end{cases}$$(在$n<k$时,该式子即类似于为卡特兰数的递推式) 考虑生成函数,令$F(x)=\sum_{n\ge 1}f_{n}x^{n}$​​,那么即$$F(x)=B\cdot F…
建立ac自动机,令$S_{x}$为以根到$x$的路径所构成的字符串以及$L_{x}=|S_{x}|,W_{x}=\sum_{1\le i\le m,t_{i}为S_{x}的后缀}w_{i}$,那么不难得到有$W_{x}=\sum_{1\le i\le m,t_{i}=S_{x}}w_{i}+W_{fail_{x}}$,即可预处理出$W$ 进一步的,令$pos(s)$为在其中查询$s$得到的最终节点,则有$f(s)=\sum_{i=1}^{|s|}W_{pos(s[1,i])}$ 接下来,考虑再求…
先将问题差分,即仅考虑上限$R$(和$L-1$) 注意到$f(x,y)$增长是较快的,对其分类讨论: 1.若$y\ge x+2$,此时满足$f(x,y)\le 10^{18}$的$(x,y)$只有约$10^{6}$组,暴力预处理并通过二分+前缀和即可 2.若$y=x+1$,显然$f(x,y)=x(x+1)$且$\varphi(f(x,y))=\varphi(x)\varphi(x+1)$ 换言之,问题即求$\sum_{x\ge 1,x(x+1)\le R}\varphi(x)\varphi(x+…
微软新任CEO纳德拉提出的“Microsoft Loves Linux”,并且微软宣布.NET框架的开源,近期Microsoft不但宣布了Linux平台的SQL Server,还宣布了Microsoft将重新建立对开源软件的支持,包括对Xamarin的收购,以及加入Eclipse基金会. SQL Server将会在 Linux上提供核心关系型数据库功能,旨在让SQL Server成为横跨Windows服务器和Linux的数据平台.目前有很多使用Linux但希望使用MS SQL Server的企业…
传送门 NanoApe Loves Sequence Ⅱ Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 1585    Accepted Submission(s): 688 Description NanoApe, the Retired Dog, has returned back to prepare for for the…
传送门 NanoApe Loves Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/131072 K (Java/Others) Total Submission(s): 1323    Accepted Submission(s): 521 Description NanoApe, the Retired Dog, has returned back to prepare for the Natio…
C. DZY Loves Colors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of n units (they…
题目 Source http://codeforces.com/problemset/problem/444/C Description DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of n units (they are numbered from 1 to n from left to right). The color of t…
A. DZY Loves Chessboard time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output DZY loves chessboard, and he enjoys playing with it. He has a chessboard of n rows and m columns. Some cells of the c…
A.Kblack loves flag [题目链接]A.Kblack loves flag [题目类型]水题 &题意: kblack喜欢旗帜(flag),他的口袋里有无穷无尽的旗帜. 某天,kblack得到了一个n*m的方格棋盘,他决定把kk面旗帜插到棋盘上. 每面旗帜的位置都由一个整数对(x,y)来描述,表示该旗帜被插在了第x行第y列. 插完旗帜后,kblack突然对那些没有插过旗帜的行和列很不满,于是他想知道,有多少行.列上所有格子都没有被插过旗帜. kblack还要把妹,于是就把这个问题丢…