前缀和
new knowledge
sherry味
Keep Thinking, Keep Coding, Keep Learning!
Always Challenge Miracle.
展开
-
I - Inquiry I(简单前缀和应用)
题目The Bureau for Artificial Problems in Competitions wants you to solve the following problem: Given n positive integers a1, . . . , an, what is the maximal value offorma.jpgInput:• A single line...原创 2020-03-27 20:47:06 · 229 阅读 · 0 评论 -
M - Marvelous Necklace(前缀和)
题目题意:给出一个字符串(首位相接),由A,B组成,若是能分割成A,B数量一样的两段,输出"YES",输出截取的位置两端a,b;否则输出"NO";思路:题目时间是500ms.字符串为1e5,若是普通暴力会超时,进行优化思路。字符串中A的数量为AA,B的数量为BB;1.AA和BB为任一为奇数就输出“No;2.否则先记录从i=0到i<len/2,计数A,B的个数(已经为题目要求的...原创 2020-02-21 23:16:57 · 198 阅读 · 0 评论 -
C. Perform the Combo(前缀和与差分)
aa原创 2020-02-28 23:23:13 · 590 阅读 · 0 评论