+ 12
Sum of two squares
How get sum of two squares if we have number N? Example: input 20 output 20 = 4^2 + 2^2
6 Respuestas
+ 10
Python.
but you can write only algorithm
I can write code self.
+ 10
Thank you!
+ 10
Thank you Carlos Ospina, but your code is wrong.
I have code which is my Playground (look "sum of two squares"
https://code.sololearn.com/cmQFXrR0fIiX/?ref=app ),  but I need more quickly algorithm...
+ 6
"""
Solution in Python. Check my codes to prove it
"""
r = N = int(input("N: "))
sqr = []
for x in range(2, N+1)[N//2::-1]:
    if x**2 <= r:
        sqr.append("{}^2".format(x))
        r -= x**2
sqr += ["1^2"]*r
        
print ("{} = {}".format(N, " + ".join(sqr)))
+ 3
in what language?



