half-consecutive(未AC)

来源:互联网 发布:胡杨网络 天津 编辑:程序博客网 时间:2024/05/17 04:46

The numbers 111,333,666,101010,151515,212121,282828,363636,454545 and ti=12i(i+1)t_i=\frac{1}{2}i(i+1)ti=21i(i+1), are called half-consecutive.

For given NNN, find the smallest rrr which is no smaller than NNN such that trt_rtr is square.

Input Format

The input contains multiple test cases.

The first line of a multiple input is an integer TTT followed by TTT input lines.

Each line contains an integer N (1≤N≤1016)N~(1\le N\le 10^{16})N (1N1016).

Output Format

For each test case, output the case number first.

Then for given NNN, output the smallest rrr.

If this half-consecutive number does not exist, output −1-11.

样例输入

412950

样例输出

Case #1: 1Case #2: 8Case #3: 49Case #4: 288
找规律
阅读全文
0 0
原创粉丝点击