考虑找到最小的整数 $x$ 使得 $x^2\ge n$,然后构造 $x$ 和 $x^2-n$。这样需要的次数为 $T(n)=1+T(\sqrt n)+T(2\sqrt n)\le 137$。但是其实有很多重复的部分,例如我们可以在 $10$ 步之内得到 $\le 12$ 的所有数,然后剩下的步数可以发现不超过 $31$,因此总步数不超过 $41$。
QOJ.ac
QOJ
Discussion #213 for Problem #7601. IQ Test
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2025-12-13 00:15:09
Last updated: 2025-12-13 00:15:13
题解
Comments
No comments yet.