题目链接:传送门 题目大意: 两个长度为n的二进制串s,t,每次操作可以将s串的一段区间取反.求操作exactly twice后使得s=t的方法数. 思路: 连续的尽可能长的 si ≠ ti 的区间简称A,连续的尽可能长的 si = ti 的区间简称B. 则1-n可以划分为若干个AB交替出现,要求操作exactly twice后s=t,就是消去所有的A. 发现每次操作最多只能使得A的数量减少1个. 所以若对于给出的s,t: ① cnt(A) ≥ 3: 不能完成,方法数为0. ② cnt(A) =…
题目:传送门. 题意:题目说的是求期望,其实翻译过来意思就是:一个长度为 n 的数列(n>=3),按顺序删除其中每一个数,每次删除都是建立在最原始数列的基础上进行的,算出每次操作后得到的新数列的相邻两数的差的绝对值的最大值,求这些n个最大值的总和. 题解:把n=3的情况单独拿出来直接算出来,就是abs(data[3]-data[2])+abs(data[2]-data[1])+abs(data[3]-data[1]),然后讨论n>=4的情况.首先遍历求出原始数列的相邻两数的差的绝对值的最大值m…
Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodities produced by the company. For each of them there is exactly one integer in the final report, that denotes correspond…
第一次做交互真有趣……:挺好的细节思维题 This is an interactive problem. In good old times dwarves tried to develop extrasensory abilities: Exactly n dwarves entered completely dark cave. Each dwarf received a hat — white or black. While in cave, none of the dwarves was…
https://vjudge.net/problem/2135388/origin Describe You are given an integer sequence 1,2,-,n. You have to divide it into two sets A and B in such a way that each element belongs to exactly one set and |sum(A)−sum(B)| is minimum possible. The value |x…