23
Zhao Xin
https://www.haoohaoo.com
Last seen 1 year ago
Member for 10 years, 8 months, 24 days
Difficulty Normal
I love coding!
ord() is fater than "abcdefgh".index().
"12345678".index() is double faster than int().
More
this is mine, easier?
import re
def translate(text):
text = re.sub('(?P[bcdfghjklmnpqrstvwxz])[aeiouy]', '\g', text)
text = re.sub('(?P[aeiouy]){3}', '\g', text)
return text
More
Am Iright? I short it like this:
def checkio(*args):
return max(args)-min(args) if args else 0
More
def checkio(data):
(x1,y1),(x2,y2),(x3,y3) = eval(data)
a = 1.* ((x1**2-x2**2+y1**2-y2**2)*(y1-y3)-(x1**2-x3**2+y1**2-y3**2)*(y1-y2)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3))
b = 1.* ((x1**2-x2**2+y1**2-y2**2)*(x1-x3)-(x1**2-x3**2+y1**2-y3**2)*(x1-x2)) / (2*(y1-y2)*(x1-
More
This is cheating :)
if orig == ' a' or orig == 'b ' or orig == ' c ':
text[0] = orig
elif orig == ' c ':
text[0] = ' c '
More
import math
def checkio(a, b, c):
angle=lambda a,b,c:int(round((math.degrees(math.acos((b*b+c*c-a*a)/2./b/c)))))
return [0,0,0] if sum((a,b,c)) <= max(a,b,c)*2 else sorted([angle(a,b,c),angle(b,a,c),angle(c,a,b)])
More