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…
problem1 link 依次枚举每个元素$x$,作为$S$中开始选择的第一个元素.对于当前$S$中任意两个元素$i,j$,若$T[i][j]$不在$S$中,则将其加入$S$,然后继续扩展:若所有的$T[i][j]$都在$S$中,则结束扩展.每次扩展结束之后保存$|S|$的最小值. problem2 link 总的思路是搜索,分别枚举每一条边是在哪个集合中,进行如下的优化: (1)使用并查集,当其中两个集合都联通时结束:当有一个集合联通时,直接判断剩下所有的边加入另一个集合能否使得另一个集合联…
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…