#P8615. [蓝桥杯 2014 国 C] 拼接平方数

[蓝桥杯 2014 国 C] 拼接平方数

Description

Xiaoming found that 4949 is very interesting. First, it is a square number. It can be split into 44 and 99, and the parts after splitting are also square numbers. 169169 also has this property. For convenience, we call such numbers: concatenated square numbers.

100100 can be split into 1,001,00, which is a bit forced. We define that 0,00,0000,00,000, etc. are not considered square numbers.

Xiaoming wonders: what other numbers are like this?

Your task is: find all concatenated square numbers within a given interval.

Input Format

Two positive integers a,b(a<b<106)a,b(a<b<10^6).

Output Format

Output several lines, one positive integer per line. Print all concatenated square numbers in the interval [a,b][a,b], in increasing order.

169 10000
169
361
1225
1444
1681
3249
4225
4900
9025

Hint

Time limit: 1 second, 256M. The 5th Lanqiao Cup 2014 National Finals.

Translated by ChatGPT 5