# -*- coding: utf-8 -*-
from cmath import *
def comp_root(x, p):
if not isinstance( p, int ) or p <= 0 :
raise ValueError("comp_root: only positive int accepted as power!")
return [ rect( pow(abs(x),1/p), (phase(x)+2*pi*n)/p )
for n in range(p)
]
for square in comp_root(27,3):
for triangle in comp_root(24/square, 3):
for circle in comp_root(96/square/triangle, 2):
answer = circle + square * triangle
print("□ = {0:.3f} △ = {1:.3f} ○ = {2:.3f} ? = {3:.3f}".format(square, triangle, circle, answer) )
IyAtKi0gY29kaW5nOiB1dGYtOCAtKi0KZnJvbSBjbWF0aCBpbXBvcnQgKgpkZWYgY29tcF9yb290KHgsIHApOgogICAgICAgIGlmIG5vdCBpc2luc3RhbmNlKCBwLCBpbnQgKSBvciBwIDw9IDAgOgogICAgICAgICAgICByYWlzZSBWYWx1ZUVycm9yKCJjb21wX3Jvb3Q6IG9ubHkgcG9zaXRpdmUgaW50IGFjY2VwdGVkIGFzIHBvd2VyISIpCiAgICAgICAgcmV0dXJuIFsgcmVjdCggcG93KGFicyh4KSwxL3ApLCAocGhhc2UoeCkrMipwaSpuKS9wICkKICAgICAgICAgICAgICAgICAgIGZvciBuIGluIHJhbmdlKHApICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICBdCgpmb3Igc3F1YXJlIGluIGNvbXBfcm9vdCgyNywzKToKICAgIGZvciB0cmlhbmdsZSBpbiBjb21wX3Jvb3QoMjQvc3F1YXJlLCAzKToKICAgICAgICBmb3IgY2lyY2xlIGluIGNvbXBfcm9vdCg5Ni9zcXVhcmUvdHJpYW5nbGUsIDIpOgogICAgICAgICAgICBhbnN3ZXIgPSBjaXJjbGUgKyBzcXVhcmUgKiB0cmlhbmdsZQogICAgICAgICAgICBwcmludCgi4pahID0gezA6LjNmfSDilrMgPSB7MTouM2Z9IOKXiyA9IHsyOi4zZn0gPyA9IHszOi4zZn0iLmZvcm1hdChzcXVhcmUsIHRyaWFuZ2xlLCBjaXJjbGUsIGFuc3dlcikgKQo=