随笔分类 - 算法基础—暴力枚举/剪枝
摘要:Acacius is studying strings theory. Today he came with the following problem. You are given a string ss of length nn consisting of lowercase English l
阅读全文
摘要:Among Johnny's numerous hobbies, there are two seemingly harmless ones: applying bitwise operations and sneaking into his dad's office. As it is usual
阅读全文
摘要:Let's define the following recurrence: an+1=an+minDigit(an)⋅maxDigit(an).an+1=an+minDigit(an)⋅maxDigit(an). Here minDigit(x)minDigit(x) and maxDigit(x
阅读全文
摘要:题目描述 Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently
阅读全文
摘要:问题描述 小明这些天一直在思考这样一个奇怪而有趣的问题: 在1~N的某个全排列中有多少个连号区间呢?这里所说的连号区间的定义是: 如果区间[L, R] 里的所有元素(即此排列的第L个到第R个元素)递增排序后能得到一个长度为R-L+1的“连续”数列,则称这个区间连号区间。 当N很小的时候,小明可以很快
阅读全文
摘要:You are given an array aa of length nn and array bb of length mm both consisting of only integers 00 and 11 . Consider a matrix cc of size n×mn×m form
阅读全文
摘要:题目描述 人类终于登上了火星的土地并且见到了神秘的火星人。人类和火星人都无法理解对方的语言,但是我们的科学家发明了一种用数字交流的方法。这种交流方法是这样的,首先,火星人把一个非常大的数字告诉人类科学家,科学家破解这个数字的含义后,再把一个很小的数字加到这个大数上面,把结果告诉火星人,作为人类的回答
阅读全文
摘要:You are given a string ss consisting of lowercase Latin letters. Let the length of ss be |s||s| . You may perform several operations on this string. I
阅读全文
摘要:You are given three integers a≤b≤ca≤b≤c . In one move, you can add +1+1 or −1−1 to any of these integers (i.e. increase or decrease any number by one)
阅读全文