from math import sqrt,pi,sin,cos
tt = int(raw_input())
_mid = sqrt(2.0)
def findRad(lower,upper,target,func):
if upper-lower<0.00000001:
return upper
mid = (upper+lower)/2.0
if func(mid-0.000001)>func(mid) or target<=func(mid):
return findRad(lower,mid,target,func)
else:
return findRad(mid,upper,target,func)
for t in xrange(1,tt+1):
area = float(raw_input())
print "Case #{0}:".format(t)
if area<_mid-0.000001:
rad = findRad(0.0,pi/4.0,area,lambda r:cos(r)+sin(r))
print "{0} {1} {2}".format(cos(rad)/2.0,sin(rad)/2.0,0)
print "{0} {1} {2}".format(-sin(rad)/2.0,cos(rad)/2.0,0)
print "0 0 0.5"
elif abs(area-_mid)<0.000001:
print "0.3535533905932738 0.3535533905932738 0"
print "-0.3535533905932738 0.3535533905932738 0"
print "0 0 0.5"
else:
x = sqrt(2.0)/4.0
rad = findRad(0.0,pi/4.0,area,lambda r:sqrt(2)*cos(r)+sin(r))
print "{0} {1} {2}".format(x,x*cos(rad),-x*sin(rad))
print "{0} {1} {2}".format(-x,x*cos(rad),-x*sin(rad))
print "{0} {1} {2}".format(0,cos(rad)/2.0,sin(rad)/2.0)
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/29968c95-03e2-47a7-a919-b14cef34ee99%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.