Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Concatenation of Perfect Squares

By khatribiru, Bishal_G · Limits 2s, 512 MB

You are given a positive integer number. You have to determine whether this number can be represented as the concatenation of perfect square numbers. A few example follows:

1259 = ‘1’ + ‘25’ + ‘9’ and

169 = ‘16’+ ‘9’ or ‘169’

Input

Input starts with an integer T (1 <= T ≤ 50000), denoting the number of test cases. Each case contains a positive integer N (1 <= N <= 1018) .

Output

For each test case, print Yes if given number can be represented as the concatenation of perfect square numbers, otherwise print No.

Sample

InputOutput
3
1259
33
169
Yes
No
Yes

    Discussion

    Statistics


    72% Solution Ratio

    RenegadesEarliest, Jul '18

    sajjad.hFastest, 0.1s

    RenegadesLightest, 262 kB

    Riz1ahmedShortest, 392B

    Submit

    Login to submit

    Related Contests

    ProgKriya July'18 Ended at 2018-07-07 17:00:00 +0000 UTC