# UVa 256

Jump to navigation
Jump to search

## Contents

## 256 - Quirksome Squares[edit]

## Summary[edit]

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[edit]

- 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:

2 digit: 4 (0+4)^2 = 16 so no. 9 (0+9)^2 = 81 so no. 81 (8+1)^2 = 81 yes.

## Optimizations[edit]

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

## Input[edit]

2 2

## Output[edit]

00 01 81 00 01 81