problem1 link 找到周期,每个周期的增量是相同的. problem2 link 对于分给某一个公司的有$c$个联通分量,其中$k$个联通分量只有1个节点,$c$个联通分量一共有$x$个节点.首先,对于那些节点大于1的联通分量($c-k$个),将这些连接在一起需要$c-k-1$条边,耗费了$2(c-k-1)$个节点.还有$x-k-2(c-k-1)$个节点可以用来连接那些只有1个节点的联通分量,分两种情况: (1)$k \leq x-k-2(c-k-1)$.这时候不需要额外的代价. (2…
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…