UVa 256 - Quirksome Squares

256 - Quirksome Squares

 * http://acm.uva.es/p/v2/256.html

Summary
Find the numbers such the sum of two numbers both of a given digit length n/2; where n can be 2,4,6,8. Find the numbers whose digits concatentated equals the sum of the two digits squared.

Explanation
2 digit: 4 (0+4)^2 = 16 so no. 9 (0+9)^2 = 81 so no. 81 (8+1)^2 = 81 yes.
 * You could precalculate this answer or you could find all the squares within the digit range of n. For example if n=2 then the squares with n or less digits will be 0,1,4,9,16...,81. but we can eliminate a number of choices when we find the appropriate numbers that add up to that specific square and figure out if its square root is equal to the square. Examples:

Optimizations

 * Get all the results and store them in an array and print them out for later use.

Input
2 2

Output
00 01 81 00 01 81