#P2063. Non-negative Integer Pairs with Sum of Squares

    ID: 15345 Type: Default 1000ms 256MiB

Non-negative Integer Pairs with Sum of Squares

Non-negative Integer Pairs with Sum of Squares

Given a positive integer \(n\), find all pairs of non-negative integers \((x, y)\) such that \(x^2 + y^2 = n\). Each pair should be printed on a new line, with the two numbers separated by a space. The pairs should be listed in increasing order of \(x\).

inputFormat

A single positive integer (n).

outputFormat

Output all pairs ((x, y)) such that (x^2 + y^2 = n). Each pair should be on a separate line in the format 'x y'.

sample

1
0 1

1 0

</p>