给定 $L$,求最小的 $n \ge L$,使得存在正整数 $m$ 满足 $2m(m + 1) = n(n + 1)$。
输入格式
本题包含多组测试数据。第一行是一个整数 $T$ ($1 \le T < 1000$),随后有 $T$ 行输入。每行包含一个整数 $L$ ($1 \le L < 10^{190}$)。
输出格式
对于每个给定的 $L$,输出最小的 $n$。如果不存在这样的 $n$,输出 $-1$。
样例
样例输入 1
3 1 4 21
样例输出 1
3 20 119
给定 $L$,求最小的 $n \ge L$,使得存在正整数 $m$ 满足 $2m(m + 1) = n(n + 1)$。
本题包含多组测试数据。第一行是一个整数 $T$ ($1 \le T < 1000$),随后有 $T$ 行输入。每行包含一个整数 $L$ ($1 \le L < 10^{190}$)。
对于每个给定的 $L$,输出最小的 $n$。如果不存在这样的 $n$,输出 $-1$。
3 1 4 21
3 20 119
The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.
This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.
If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.
Guidelines: