TPK algorithm: Difference between revisions

Content deleted Content added
m Perl golf: <source>
m Python version: <source>
Line 36:
The following Python version of the algorithm uses the common Python idiom of using a list instead of an array, (although there is an array module available):
 
<source lang=python>
from math import sqrt
def f(t):
def f(t):
return sqrt(abs(t))+5*t**3
a = [int(raw_input()) for i in range(11)]
for i in range(10,-1,-1):
y = f(a[i])
if y > 400:
print i, "TOO LARGE"
else:
print i, y
</source>
 
==References==