problem1 link 其实就是找到一个数字$t$,使得$x$的二进制为1 的位上$t$也都为1.然后$t$删掉所有那些$x$为1的二进制位就是$k$. problem2 link 设所有合法的边的个数为$m(m \leq C_{10}^{2}=45)$.状态$mask$记录每个点的度数.$f[i][j]$表示处理到第$i$条边,目前每个点度数的状态为$j$ 的最小距离.不需要记录选的边的个数是因为可以从$j$推算出来. problem3 link 将$n$平分为前一半后一半,两边分别暴力枚…
problem1 link 倒着想.每次添加一个右括号再添加一个左括号,直到还原.那么每次的右括号的选择范围为当前左括号后面的右括号减去后面已经使用的右括号. problem2 link 令$h(x)=\sum_{i=1}^{x}g(i)$,那么答案为$h(R)-h(L-1)$.对于$h(x)$: (1)如果$x\leq K$,那么$h(x)=0$ (2)否则对于$[K+1,x]$之间的所有偶数来说,对答案的贡献为$even+h(\frac{x}{2})-h(\frac{K}{2})$,其中$e…
Problem Statement You are given the ints perimeter and area. Your task is to find a triangle with the following properties: The coordinates of each vertex are integers between 0 and 3000, inclusive. The perimeter of the triangle must be exactly…
Problem Statement The Happy Letter game is played as follows: At the beginning, several players enter the field. Each player has a lowercase English letter on their back. The game is played in turns. In each turn, you select two players with dif…