s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s304999486 | p02273 | u970436839 | 1452684526 | Python | Python | py | Runtime Error | 0 | 0 | 530 | def koch(n, a, b):
if n == 0:
return
s[0] = (2*a[0]* + b[0])/3
s[1] = (2*a[1]* + b[1])/3
t[0] = (a[0]* + 2*b[0])/3
t[1] = (a[1]* + 2*b[1])/3
u[0] = (t[0] - s[0])*cos(pi/3) - (t[1] - s[1])*sin(pi/3) + s[0]
u[1] = (t[0] - s[0])*sin(pi/3) + (t[1] - s[1])*cos(pi/3) + s[1]
koch(n-1, a, s)
print s[0],... |
s407591561 | p02273 | u970436839 | 1452685013 | Python | Python | py | Runtime Error | 0 | 0 | 534 | def koch(n, a, b):
if n == 0:
return
s[0] = (2*a[0] + b[0])/3
s[1] = (2*a[1] + b[1])/3
t[0] = (a[0] + 2*b[0])/3
t[1] = (a[1] + 2*b[1])/3
u[0] = (t[0] - s[0])*cos(pi/3) - (t[1] - s[1])*sin(pi/3) + s[0]
u[1] = (t[0] - s[0])*sin(pi/3) + (t[1] - s[1])*cos(pi/3) + s[1]
koch(n-1, a, s)
print s[0], s[1... |
s739591119 | p02273 | u970436839 | 1452685171 | Python | Python | py | Runtime Error | 0 | 0 | 531 | def koch(n, a, b):
if n == 0:
return
s[0] = (2*a[0] + b[0])/3
s[1] = (2*a[1] + b[1])/3
t[0] = (a[0] + 2*b[0])/3
t[1] = (a[1] + 2*b[1])/3
u[0] = (t[0] - s[0])*cos(pi/3) - (t[1] - s[1])*sin(pi/3) + s[0]
u[1] = (t[0] - s[0])*sin(pi/3) + (t[1] - s[1])*cos(pi/3) + s[1]
koch(n-1, a, s)
print s[0], s[1]... |
s739564823 | p02273 | u970436839 | 1452686361 | Python | Python | py | Runtime Error | 0 | 0 | 590 | class coordinates:
def __init__(self, x, y):
self.x = x
self.y = y
def koch(n, a, b):
if n == 0:
return
s = coordinates((2*a[0] + b[0])/3, (2*a[1] + b[1])/3)
t = coordinates((a[0] + 2*b[0])/3, (a[1] + 2*b[1])/3)
ux = (t.x - s.x)*cos(pi/3) - (t.y - s.y)*sin(pi/3) + s.x
uy = (t.x - s.y)*sin(pi/3)... |
s898048096 | p02273 | u970436839 | 1452686411 | Python | Python | py | Runtime Error | 0 | 0 | 582 | class coordinates:
def __init__(self, x, y):
self.x = x
self.y = y
def koch(n, a, b):
if n == 0:
return
s = coordinates((2*a.x + b.x)/3, (2*a.y + b.y)/3)
t = coordinates((a.x + 2*b.x)/3, (a.y + 2*b.y)/3)
ux = (t.x - s.x)*cos(pi/3) - (t.y - s.y)*sin(pi/3) + s.x
uy = (t.x - s.y)*sin(pi/3) + (t.y ... |
s722653457 | p02273 | u970436839 | 1452686451 | Python | Python | py | Runtime Error | 0 | 0 | 602 | class coordinates:
def __init__(self, x, y):
self.x = x
self.y = y
def koch(n, a, b):
if n == 0:
return
s = coordinates((2*a.x + b.x)/3, (2*a.y + b.y)/3)
t = coordinates((a.x + 2*b.x)/3, (a.y + 2*b.y)/3)
ux = (t.x - s.x)*cos(pi/3) - (t.y - s.y)*sin(pi/3) + s.x
uy = (t.x - s.y)*sin(pi/3) + (t.y ... |
s599581097 | p02273 | u970436839 | 1452686514 | Python | Python | py | Runtime Error | 10 | 6380 | 620 | class coordinates:
def __init__(self, x, y):
self.x = x
self.y = y
def koch(n, a, b):
if n == 0:
return
s = coordinates((2*a.x + b.x)/3, (2*a.y + b.y)/3)
t = coordinates((a.x + 2*b.x)/3, (a.y + 2*b.y)/3)
ux = (t.x - s.x)*cos(pi/3) - (t.y - s.y)*sin(pi/3) + s.x
uy = (t.x - s.y)*sin(pi/3) + (t.y ... |
s775477521 | p02273 | u970436839 | 1452687189 | Python | Python | py | Runtime Error | 10 | 6376 | 625 | class coordinates:
def __init__(self, x, y):
self.x = x
self.y = y
def koch(n, a, b):
if n == 0:
return
s = coordinates((2*a.x + b.x)/3, (2*a.y + b.y)/3)
t = coordinates((a.x + 2*b.x)/3, (a.y + 2*b.y)/3)
ux = (t.x - s.x)*cos(pi/3) - (t.y - s.y)*sin(pi/3) + s.x
uy = (t.x - s.x)*sin(pi/3) + (t.y... |
s567906264 | p02273 | u970436839 | 1452687414 | Python | Python | py | Runtime Error | 10 | 6484 | 649 | class coordinates:
def __init__(self, x, y):
self.x = x
self.y = y
def koch(n, a, b):
if n == 0:
return
s = coordinates((2.0*a.x + b.x)/3.0, (2.0*a.y + b.y)/3.0)
t = coordinates((a.x + 2.0*b.x)/3.0, (a.y + 2.0*b.y)/3.0)
ux = (t.x - s.x)*cos(pi/3.0) - (t.y - s.y)*sin(pi/3.0) + s.x
uy = (t.x - s... |
s365102605 | p02273 | u000228958 | 1452754211 | Python | Python | py | Runtime Error | 0 | 0 | 822 | import math
class Point:
def __init__(self, num_x, num_y):
self.x = num_x
self.y = num_y
def kock(n, p1, p2):
if n == 0:
return
s = Point((2 * p1.x + 1 * p2.x) / 3.0, (2 * p1.y + 1 * p2.y) / 3.0)
t = Point((1 * p1.x + 2 * p2.x) / 3.0, (1 * p1.y + 2 * p2.y) / 3.0)
u = P... |
s839010975 | p02273 | u724923896 | 1452840202 | Python | Python | py | Runtime Error | 10 | 6412 | 534 | import math
n = input()
px = 0
py = 0
qx = 100
qy = 0
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*math.cos(60) - (t.y-s.y)*math.sin(60) + s.x
u.y = (t.x-s.x)*math.sin(60) - (t.y-s.y)*math.cos(60) + s.y
koc... |
s755394778 | p02273 | u724923896 | 1452840370 | Python | Python | py | Runtime Error | 10 | 6384 | 542 | import math
n = input()
px = 0
py = 0
qx = 100
qy = 0
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*math.cos(pi/3) - (t.y-s.y)*math.sin(pi/3) + s.x
u.y = (t.x-s.x)*math.sin(pi/3) - (t.y-s.y)*math.cos(pi/3) + s... |
s108330817 | p02273 | u724923896 | 1452840416 | Python | Python | py | Runtime Error | 10 | 6424 | 528 | import math
n = input()
px = 0
py = 0
qx = 100
qy = 0
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*cos(pi/3) - (t.y-s.y)*sin(pi/3) + s.x
u.y = (t.x-s.x)*sin(pi/3) - (t.y-s.y)*cos(pi/3) + s.y
koch(n-1, ... |
s584469937 | p02273 | u724923896 | 1452840606 | Python | Python | py | Runtime Error | 10 | 6536 | 562 | import math
n = input()
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*cos(pi/3) - (t.y-s.y)*sin(pi/3) + s.x
u.y = (t.x-s.x)*sin(pi/3) - (t.y-s.... |
s217132065 | p02273 | u724923896 | 1452840727 | Python | Python | py | Runtime Error | 10 | 6420 | 588 | import math
n = input()
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*math.cos(pi/3) - (t.y-s.y)*math.sin(pi/3) + s.x
u.y = (t.x-s.x)*math.... |
s851975591 | p02273 | u724923896 | 1452840830 | Python | Python | py | Runtime Error | 10 | 6464 | 568 | import math
n = input()
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*cos(pi/3) - (t.y-s.y)*sin(pi/3) + s.x
u.y = (t.x-s.x)*sin(pi/3) + (t.... |
s735746479 | p02273 | u724923896 | 1452840904 | Python | Python | py | Runtime Error | 10 | 6448 | 574 | import math
n = input()
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*cos(pi/3) - (t.y-s.y)*sin(pi/3) + s.x
u.y = (t.x-s.x)*sin(pi/3) +... |
s995970017 | p02273 | u724923896 | 1452841071 | Python | Python | py | Runtime Error | 10 | 6392 | 600 | import math
n = input()
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*math.cos(pi/3) - (t.y-s.y)*math.sin(pi/3) + s.x
u.y = (t.x-s.... |
s431867060 | p02273 | u724923896 | 1452841326 | Python | Python | py | Runtime Error | 0 | 6412 | 626 | import math
n = input()
px = float(0)
py = float(0)
qx = float(100)
qy = float(0)
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx*1)/3
s.y = (py*2+qy*1)/3
t.x = (px*1+qx*2)/3
t.y = (py*1+qy*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
... |
s606302936 | p02273 | u724923896 | 1452841483 | Python | Python | py | Runtime Error | 10 | 6380 | 617 | import math
def koch(n, px, py, qx, qy):
if n == 0:
return
s.x = (px*2+qx)/3
s.y = (py*2+qy)/3
t.x = (px+qx*2)/3
t.y = (py+qy*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
u.y = (t.x-s.x)*math.sin(math.pi/3) + (t.y-s.y)*math.cos(math.pi/3) + s.y
koch(n... |
s400318068 | p02273 | u724923896 | 1452843788 | Python | Python | py | Runtime Error | 0 | 0 | 631 | import math
def koch(n, p.x, p.y, q.x, q.y):
if n == 0:
return
s.x = (p.x*2+q.x)/3
s.y = (p.y*2+q.y)/3
t.x = (p.x+q.x*2)/3
t.y = (p.y+q.y*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
u.y = (t.x-s.x)*math.sin(math.pi/3) + (t.y-s.y)*math.cos(math.pi/3) + s.y
... |
s836470803 | p02273 | u724923896 | 1452844213 | Python | Python | py | Runtime Error | 10 | 6384 | 607 | import math
def koch(n, h, i, j, k):
if n == 0:
return
s.x = (h*2+j)/3
s.y = (i*2+k)/3
t.x = (h+j*2)/3
t.y = (i+k*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
u.y = (t.x-s.x)*math.sin(math.pi/3) + (t.y-s.y)*math.cos(math.pi/3) + s.y
koch(n-1, h, i,... |
s595948319 | p02273 | u724923896 | 1452844835 | Python | Python | py | Runtime Error | 0 | 0 | 665 | import math
n = input()
p.x = float(0)
p.y = float(0)
q.x = float(100)
q.y = float(0)
def koch(n, p.x, p.y, q.x, q.y):
if n == 0:
return
s.x = (p.x*2+q.x*1)/3
s.y = (p.y*2+q.y*1)/3
t.x = (p.x*1+q.x*2)/3
t.y = (p.y*1+q.y*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.s... |
s884503968 | p02273 | u724923896 | 1452924251 | Python | Python | py | Runtime Error | 10 | 6524 | 613 | import math
def koch(n, h, i, j, k):
if n == 0:
return
s.x = (h*2+j)/3
s.y = (i*2+k)/3
t.x = (h+j*2)/3
t.y = (i+k*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
u.y = (t.x-s.x)*math.sin(math.pi/3) + (t.y-s.y)*math.cos(math.pi/3) + s.y
koch(n-1, h,... |
s895532720 | p02273 | u724923896 | 1452924541 | Python | Python | py | Runtime Error | 10 | 6412 | 607 | import math
def koch(n, h, i, j, k):
if n == 0:
return
s.x = (h*2+j)/3
s.y = (i*2+k)/3
t.x = (h+j*2)/3
t.y = (i+k*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
u.y = (t.x-s.x)*math.sin(math.pi/3) + (t.y-s.y)*math.cos(math.pi/3) + s.y
koch(n-1, h, i, s.x, ... |
s476763292 | p02273 | u724923896 | 1452924673 | Python | Python | py | Runtime Error | 10 | 6388 | 444 | import math
def koch(n, h, i, j, k):
if n == 0:
return
s.x = (h*2+j)/3
s.y = (i*2+k)/3
t.x = (h+j*2)/3
t.y = (i+k*2)/3
u.x = (t.x-s.x)*math.cos(math.pi/3) - (t.y-s.y)*math.sin(math.pi/3) + s.x
u.y = (t.x-s.x)*math.sin(math.pi/3) + (t.y-s.y)*math.cos(math.pi/3) + s.y
n = input()
... |
s102549056 | p02273 | u619765879 | 1452966475 | Python | Python | py | Runtime Error | 0 | 0 | 702 | def koch(n, a_x, a_y, b_x, b_y):
if n == 0:
return
th = math.pi*60.0/180.0
s_x = (2.0*a_x + 1.0*b_x)/3.0
s_y = (2.0*a_x + 1.0*b_x)/3.0
t_x = (1.0*a_x + 2.0*b_x)/3.0
t_y = (1.0*a_x + 2.0*b_x)/3.0
u_x = (t_x - s_x)*cos(th) + (t_y - s_y)*sin(th) + s_x
u_y = (t_x - s_x)*sin(th) + (t_y - s_y)*cos(th) +... |
s213635075 | p02273 | u619765879 | 1452966874 | Python | Python | py | Runtime Error | 0 | 0 | 722 | def koch(n, a_x, a_y, b_x, b_y):
if n == 0:
return
th = math.pi*60.0/180.0
s_x = (2.0*a_x + 1.0*b_x)/3.0
s_y = (2.0*a_x + 1.0*b_x)/3.0
t_x = (1.0*a_x + 2.0*b_x)/3.0
t_y = (1.0*a_x + 2.0*b_x)/3.0
u_x = (t_x - s_x)*math.cos(th) + (t_y - s_y)*math.sin(th) + s_x
u_y = (t_x - s_x)*math.sin(th) + (t_y -... |
s247399661 | p02273 | u619765879 | 1452966983 | Python | Python | py | Runtime Error | 0 | 0 | 733 | def koch(n, a_x, a_y, b_x, b_y):
if n == 0:
return
th = math.pi*60.0/180.0
s_x = (2.0*a_x + 1.0*b_x)/3.0
s_y = (2.0*a_x + 1.0*b_x)/3.0
t_x = (1.0*a_x + 2.0*b_x)/3.0
t_y = (1.0*a_x + 2.0*b_x)/3.0
u_x = (t_x - s_x)*math.cos(th) + (t_y - s_y)*math.sin(th) + s_x
u_y = (t_x - s_x)*math.sin(th) + (t_y -... |
s368570963 | p02273 | u619765879 | 1452967193 | Python | Python | py | Runtime Error | 10 | 6372 | 726 | def koch(n, a_x, a_y, b_x, b_y):
if n == 0:
return
th = math.pi*60.0/180.0
s_x = (2.0*a_x + 1.0*b_x)/3.0
s_y = (2.0*a_x + 1.0*b_x)/3.0
t_x = (1.0*a_x + 2.0*b_x)/3.0
t_y = (1.0*a_x + 2.0*b_x)/3.0
u_x = (t_x - s_x)*math.cos(th) + (t_y - s_y)*math.sin(th) + s_x
u_y = (t_x - s_x)*math.sin(th) + (t_y... |
s408512372 | p02273 | u253463900 | 1453116789 | Python | Python3 | py | Runtime Error | 0 | 0 | 845 | import math
class point:
def __init__(self):
self.x = 0.0
self.y = 0.0
def koch(n,a,b):
if n == 0 :
return
rad = 1.0471975511965976 ???# 60 deg
s = point()
t = point()
u = point()
tmp = point()
s.x = (2 * a.x + b.x) / 3.0
s.y = (2 * a.y + b.y) / 3.0
... |
s138729087 | p02273 | u233232390 | 1453194745 | Python | Python | py | Runtime Error | 0 | 0 | 579 | import math
sin60 = math.sin(60*math.pi/180)
def koch(n,p1,p2):
if n==0:
return
s = [ ( 2*p1[0] + 1*p2[0] ) / 3 , ( 2*p1[1] + 1*p2[1]) / 3 ]
t = [ ( 1*p1[0] + 2*p2[0] ) / 3 , ( 1*p1[1] + 2*p2[1]) / 3 ]
u = [ ( t[0] - s[0] ) *0.5 - ( t[1] - s[1] )*sin60 + s[0],
( t[0] - s[0] )*sin60 + ( t... |
s529469311 | p02273 | u233232390 | 1453194769 | Python | Python | py | Runtime Error | 0 | 0 | 583 | import math
sin60 = math.sin(60*math.pi/180)
def koch(n,p1,p2):
if n==0:
return
s = [ ( 2*p1[0] + 1*p2[0] ) / 3. , ( 2*p1[1] + 1*p2[1]) / 3. ]
t = [ ( 1*p1[0] + 2*p2[0] ) / 3. , ( 1*p1[1] + 2*p2[1]) / 3. ]
u = [ ( t[0] - s[0] ) *0.5 - ( t[1] - s[1] )*sin60 + s[0],
( t[0] - s[0] )*sin60 +... |
s887954923 | p02273 | u233232390 | 1453194813 | Python | Python | py | Runtime Error | 10 | 6452 | 503 | import math
def koch(n,p1,p2):
if n==0:
return
s = [(2*p1[0]+1*p2[0])/3, (2*p1[1]+1*p2[1])/3]
t = [(1*p1[0]+2*p2[0])/3, (1*p1[1]+2*p2[1])/3]
u = [(t[0]-s[0])*0.5 - (t[1]-s[1])*sin60+ s[0],
(t[0]-s[0])*sin60 + (t[1]-s[1])*0.5 + s[1]]
koch(n-1,p1,s)
print s[0],s[1]
koch(n-1,s,... |
s315282562 | p02273 | u393769849 | 1453202578 | Python | Python | py | Runtime Error | 10 | 6352 | 850 | n = int(raw_input())
p1_x = float(0)
p1_y = float(0)
p2_x = float(100)
p2_y = float(0)
def KC(i, n, x1, y1, x2, y2):
v = [0]*5
w = [0]*5
if i < n:
v[0] = x1
w[0] = y1
v[1] = (2*x1+x2)/3.0
w[1] = (2*y1+y2)/3.0
v[2] = (x1+2*x2)/3.0
w[2] = (y1+2*y2)/3.0
... |
s356769389 | p02273 | u424209323 | 1453204709 | Python | Python | py | Runtime Error | 0 | 0 | 613 | import math
def kock(n, x1, y1, x1, y2):
if n == 0:
return
angle = math.radians(60)
sx = (2*x1 + x2)/3
sy = (2*y1 + y2)/3
tx = (2*x2 + x1)/3
ty = (2*y2 + y1)/3
ux = (tx - sx)*math.cos(angle) - (ty - sy)*math.sin(angle) + sx
uy = (tx - sx)*math.sin(angle) + (ty - sy)*math.cos(a... |
s644551761 | p02273 | u424209323 | 1453204733 | Python | Python | py | Runtime Error | 0 | 0 | 613 | import math
def kock(n, x1, y1, x1, y2):
if n == 0:
return
angle = math.radians(60)
sx = (2*x1 + x2)/3
sy = (2*y1 + y2)/3
tx = (2*x2 + x1)/3
ty = (2*y2 + y1)/3
ux = (tx - sx)*math.cos(angle) - (ty - sy)*math.sin(angle) + sx
uy = (tx - sx)*math.sin(angle) + (ty - sy)*math.cos(a... |
s510878815 | p02273 | u563876281 | 1453206969 | Python | Python | py | Runtime Error | 0 | 0 | 571 | n = int(raw_input())
p1 = complex(0,0)
p2 = complex(100,0)
for e in koch(p1,p2,n):
print e.real,e.imagimport math, cmath
def koch(p1, p2, n):
if n == 0:
return [p1, p2]
rad60 = math.pi/3
v1 = (p2 - p1)/3
v2 = cmath.rect(abs(v1), cmath.phase(v1)+rad60)
q1 = p1 + v1
q2 = q1 +... |
s090212610 | p02273 | u563876281 | 1453207009 | Python | Python | py | Runtime Error | 0 | 0 | 583 | import math
n = int(raw_input())
p1 = complex(0,0)
p2 = complex(100,0)
for e in koch(p1,p2,n):
print e.real,e.imagimport math, cmath
def koch(p1, p2, n):
if n == 0:
return [p1, p2]
rad60 = math.pi/3
v1 = (p2 - p1)/3
v2 = cmath.rect(abs(v1), cmath.phase(v1)+rad60)
q1 = p1 + v1
... |
s928610625 | p02273 | u563876281 | 1453207068 | Python | Python | py | Runtime Error | 0 | 0 | 645 | import math, cmath
n = int(raw_input())
p1 = complex(0,0)
p2 = complex(100,0)
for e in koch(p1,p2,n):
print e.real,e.imag
def koch(p1, p2, n):
if n == 0:
return [p1, p2]
rad60 = math.pi/3
v1 = (p2 - p1)/3
v2 = cmath.rect(abs(v1), cmath.phase(v1)+rad60)
q1 = p1 + v1
q2 = q1... |
s050397794 | p02273 | u563876281 | 1453207235 | Python | Python | py | Runtime Error | 0 | 0 | 574 | import math, cmath
def koch(v1, v2, n):
if n == 0:
return [v1, v2]
rad60 = math.pi/3
u1 = (v2 - v1)/3
u2 = cmath.rect(abs(u1), cmath.phase(u1)+rad60)
q1 = v1 + u1
q2 = q1 + u2
q3 = q1 + u1
if n == 1:
return [v1,q1,q2,q3,v2]
else:
x1 = koch(v1,q1,n-1)[:... |
s627813065 | p02273 | u047737909 | 1453208180 | Python | Python | py | Runtime Error | 0 | 0 | 886 | import math
x1 = 0
y1 = 0
x2 = 100
y2 = 0
def koch curve(i, n, x1, y1, x2, y2):
x = [0] * 5
y = [0] * 5
if i < n:
x[0] = x1
y[0] = y1
x[1] = (2 * x1 + x2) / 3.0
y[1] = (2 * y1 + y2) / 3.0
x[2] = (x1 + 2 * x2) / 3.0
y[2] = (y1 + 2 * y2) / 3.0
x[3... |
s412235126 | p02273 | u047737909 | 1453208385 | Python | Python | py | Runtime Error | 0 | 0 | 887 |
import math
x1 = 0
y1 = 0
x2 = 100
y2 = 0
def koch curve(i, n, x1, y1, x2, y2):
x = [0] * 5
y = [0] * 5
if i < n:
x[0] = x1
y[0] = y1
x[1] = (2 * x1 + x2) / 3.0
y[1] = (2 * y1 + y2) / 3.0
x[2] = (x1 + 2 * x2) / 3.0
y[2] = (y1 + 2 * y2) / 3.0
x[... |
s042003325 | p02273 | u047737909 | 1453208452 | Python | Python | py | Runtime Error | 0 | 0 | 837 |
ef koch_curve(i, n, x1, y1, x2, y2):
x = [0] * 5
y = [0] * 5
if i < n:
x[0] = x1
y[0] = y1
x[1] = (2 * x1 + x2) / 3.0
y[1] = (2 * y1 + y2) / 3.0
x[2] = (x1 + 2 * x2) / 3.0
y[2] = (y1 + 2 * y2) / 3.0
x[3] = (x[2] - x[1]) * math.cos(math.pi/3) - (x[2] -... |
s778357397 | p02273 | u047737909 | 1453208516 | Python | Python | py | Runtime Error | 0 | 0 | 886 | import math
x1 = 0
y1 = 0
x2 = 100
y2 = 0
def koch_curve(i, n, x1, y1, x2, y2):
x = [0] * 5
y = [0] * 5
if i < n:
x[0] = x1
y[0] = y1
x[1] = (2 * x1 + x2) / 3.0
y[1] = (2 * y1 + y2) / 3.0
x[2] = (x1 + 2 * x2) / 3.0
y[2] = (y1 + 2 * y2) / 3.0
x[3... |
s572999840 | p02273 | u047737909 | 1453208638 | Python | Python | py | Runtime Error | 0 | 0 | 886 | import math
x1 = 0
y1 = 0
x2 = 100
y2 = 0
def koch_curve(i, n, x1, y1, x2, y2):
x = [0] * 5
y = [0] * 5
if i < n:
x[0] = x1
y[0] = y1
x[1] = (2 * x1 + x2) / 3.0
y[1] = (2 * y1 + y2) / 3.0
x[2] = (x1 + 2 * x2) / 3.0
y[2] = (y1 + 2 * y2) / 3.0
x[3... |
s721207655 | p02273 | u536494052 | 1453215278 | Python | Python | py | Runtime Error | 0 | 0 | 1050 | 03 sec 6668 KB 36 lines 878 bytes 2016-01-16 19:46
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import math
n = input()
p1_x = float(0)
p1_y = float(0)
p2_x = float(100)
p2_y = float(0)
def kock(i, n, x1, y1, x2, y2):
a = [0,0,0,0,0]
... |
s850112301 | p02273 | u536494052 | 1453215362 | Python | Python | py | Runtime Error | 0 | 0 | 1050 | 03 sec 6668 KB 36 lines 878 bytes 2016-01-16 19:46
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import math
n = input()
p1_x = float(0)
p1_y = float(0)
p2_x = float(100)
p2_y = float(0)
def kock(i, n, x1, y1, x2, y2):
a = [0,0,0,0,0]
... |
s114137053 | p02273 | u824216249 | 1453215450 | Python | Python | py | Runtime Error | 0 | 0 | 629 | import math
def koch(n, x1, y1, x2, y2):
if n == 0:
return
angle = math.radians(60)
sx = (2*x1 + x2)/3
sy = (2*y1 + y2)/3
tx = (2*x2 + x1)/3
ty = (2*y2 + y1)/3
ux = (tx - sx)*math.cos(angle) - (ty - sy)*math.sin(angle) + sx
uy = (tx - sx)*math.sin(angle) + (ty - sy)*math.c... |
s352038478 | p02273 | u177808190 | 1453217138 | Python | Python | py | Runtime Error | 0 | 0 | 692 | degree = math.pi / 3
def print_point(point):
print "%f %f"
def koch(depth, p1, p2):
if depth == 0:
return
s = ((2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3)
t = ((p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3)
u = ((t[0] - s[0]) * math.cos(degree) - (t[1] - s[1]) * math.sin(degree)... |
s147468535 | p02273 | u177808190 | 1453249039 | Python | Python | py | Runtime Error | 0 | 0 | 823 | import math
n = int(raw_input())
degree = math.pi / 3
??????????
def print_point(point):
????????print "%f %f" % (point[0], point[1])
??????????
def koch(depth, p1, p2):
????????if depth == 0:
????????????????return
????????s = ((2 * p1[0] + p2[0]) / 3, (2 * p1[1] + p2[1]) / 3)
????????t = ((p1[0] + 2 * p2[0]) / 3, (p1... |
s800214734 | p02273 | u682357930 | 1453258208 | Python | Python | py | Runtime Error | 0 | 0 | 585 | import math
n = input()
def koch(n, p1_x, p2_x, p1_y, p2_y):
if n == 0:
return
%p1, p2 ?????? s, t, u ????¨????
s_x = (2*p1_x + p2_x) / 3
s_y = (2*p1_y + p2_y) / 3
t_x = (p1_x + 2*p2_x) / 3
t_y = (p1_y + 2*p2_y) / 3
u_x = (t_x - s_x)/2 - (t_y - s_y) * sqrt(3)/2 + s_x
u_y = (t_x - s_x) * sqrt(3... |
s820803459 | p02273 | u682357930 | 1453258283 | Python | Python | py | Runtime Error | 0 | 0 | 634 | import math
n = input()
def koch(n, p1_x, p2_x, p1_y, p2_y):
if n == 0:
return
%p1, p2 ?????? s, t, u ????¨????
s_x = (2*p1_x + p2_x) / 3
s_y = (2*p1_y + p2_y) / 3
t_x = (p1_x + 2*p2_x) / 3
t_y = (p1_y + 2*p2_y) / 3
u_x = (t_x - s_x)/2 - (t_y - s_y) * sqrt(3)/2 + s_x
u_y = (t_x - s_x) * sqrt(3... |
s772087317 | p02273 | u682357930 | 1453258310 | Python | Python | py | Runtime Error | 10 | 6412 | 595 | import math
n = input()
def koch(n, p1_x, p2_x, p1_y, p2_y):
if n == 0:
return
s_x = (2*p1_x + p2_x) / 3
s_y = (2*p1_y + p2_y) / 3
t_x = (p1_x + 2*p2_x) / 3
t_y = (p1_y + 2*p2_y) / 3
u_x = (t_x - s_x)/2 - (t_y - s_y) * sqrt(3)/2 + s_x
u_y = (t_x - s_x) * sqrt(3)/2 + (t_y - s_y)/2 + s_y
koch(n-1,... |
s630453693 | p02273 | u334643297 | 1453258370 | Python | Python | py | Runtime Error | 0 | 0 | 409 | import math
from numpy import array
def koch(n, a, b):
print '%.8f %.8f' % (a[0], a[1])
if(n == 0):
return
x = (a*2 + b) / 3
y = (a - b) * array([math.cos(math.pi/3), -math.sin(math.pi/3)],[math.sin(math.pi/3), math.cos(math.pi/3)]) + x
z = (a + b*2) / 3
koch(n-1, a, x)
koch(n-1, x, y)
koch(n-1, y, z)
koch(... |
s875097209 | p02273 | u682357930 | 1453258393 | Python | Python | py | Runtime Error | 10 | 6456 | 595 | import math
n = input()
def koch(n, p1_x, p2_x, p1_y, p2_y):
if n == 0:
return
s_x = (2*p1_x + p2_x) / 3
s_y = (2*p1_y + p2_y) / 3
t_x = (p1_x + 2*p2_x) / 3
t_y = (p1_y + 2*p2_y) / 3
u_x = (t_x - s_x)/2 - (t_y - s_y) * sqrt(3)/2 + s_x
u_y = (t_x - s_x) * sqrt(3)/2 + (t_y - s_y)/2 + s_y
koch(n-1,... |
s665945407 | p02273 | u682357930 | 1453258709 | Python | Python | py | Runtime Error | 10 | 6524 | 595 | import math
n = input()
def koch(n, p1_x, p2_x, p1_y, p2_y):
if n == 0:
return
s_x = (2*p1_x + p2_x) / 3
s_y = (2*p1_y + p2_y) / 3
t_x = (p1_x + 2*p2_x) / 3
t_y = (p1_y + 2*p2_y) / 3
u_x = (t_x - s_x)/2 - (t_y - s_y) * sqrt(3)/2 + s_x
u_y = (t_x - s_x) * sqrt(3)/2 + (t_y - s_y)/2 + s_y
koch(n-1,... |
s968913197 | p02273 | u963402991 | 1459471031 | Python | Python3 | py | Runtime Error | 20 | 7756 | 820 | import math
n = int(input())
theta = math.pi / 3
p1 = [0, 0]
p2 = [100, 0]
def kock(d, p1, p2):
if d == 0:
return
sx = (p1[0] + 2 * p2[0]) / 3
tx = (2 * p1[0] + p2[0]) / 3
sy = (p1[1] + 2 * p2[1]) / 3
ty = (2 * p1[1] + p2[1]) / 3
s = [sx, sy]
t = [tx, ty]
ux = (t[0] - s[0]) ... |
s856123681 | p02273 | u086566114 | 1493173665 | Python | Python3 | py | Runtime Error | 0 | 0 | 2048 | # coding=utf-8
import math
def divide_segment(left, right):
"""divide segment
Args:
left: left edge coordinate
right: right edge coordinate
Returns:
divided points
"""
delta_x_quarter = (right[0] - left[0]) / 3.0
delta_y_quarter = (right[1] - left[1]) / 3.0
delta... |
s196323602 | p02273 | u003309334 | 1495817495 | Python | Python3 | py | Runtime Error | 0 | 0 | 544 | import numpy as np
import math
def kochCurve(p1, p2, n):
if n == 0:
print(p2[0], p2[1])
return
v = (p2 - p1)/3
s = p1 + v
t = s + v
theta = math.atan2(v[1], v[0])
a = np.linalg.norm(t - s)
h = 3**(1/2)*a/2
u = s + (t - s)/2 + np.array([h*math.sin(theta), h*math.cos(theta)])
# print(n, p1, ... |
s416917819 | p02273 | u003309334 | 1495817600 | Python | Python3 | py | Runtime Error | 0 | 0 | 542 | import numpy as np
import math
def kochCurve(p1, p2, n):
if n == 0:
print(p2[0], p2[1])
return
v = (p2 - p1)/3
s = p1 + v
t = s + v
theta = math.atan2(v[1], v[0])
a = np.linalg.norm(t - s)
h = 3**(1/2)*a/2
u = s + (t - s)/2 + np.array([h*math.sin(theta), h*math.cos(theta)])
# print(n, p1, ... |
s419505599 | p02273 | u918276501 | 1499294057 | Python | Python3 | py | Runtime Error | 0 | 0 | 567 | import numpy as np
def koch_divide(p,q):
v = q-p
r = np.array([[0.866, 0.5],[-0.5, 0.866]])
s = p + v/3
t = q - v/3
u = p + np.dot(v,r)/np.sqrt(3)
return [s,u,t,q]
def koch_curve(previous):
vertices = [previous[0]]
for p,q in zip(previous[:-1], previous[1:]):
vertices.append(ko... |
s565769526 | p02273 | u918276501 | 1499294365 | Python | Python3 | py | Runtime Error | 0 | 0 | 581 | import numpy as np
def koch_divide(p,q):
v = q-p
r = np.array([[np.sqrt(3)/2, 0.5],[-0.5, np.sqrt(3)/2]])
s = p + v/3
t = q - v/3
u = p + np.dot(v,r)/np.sqrt(3)
return [s,u,t,q]
def koch_curve(previous):
vertices = [previous[0]]
for p,q in zip(previous[:-1], previous[1:]):
vert... |
s974037051 | p02273 | u918276501 | 1499295901 | Python | Python3 | py | Runtime Error | 0 | 0 | 601 | import numpy as np
def koch_divide(p,q):
v = q-p
r = np.array([[np.sqrt(3)/2, 0.5],[-0.5, np.sqrt(3)/2]])
s = p + v/3
t = q - v/3
u = p + np.dot(v,r)/np.sqrt(3)
return [s,u,t,q]
def koch_curve(previous):
vertices = [previous[0]]
for p,q in zip(previous[:-1], previous[1:]):
vert... |
s642131212 | p02273 | u264972437 | 1501304795 | Python | Python3 | py | Runtime Error | 0 | 0 | 557 | import math
def koch(p2, n, points):
p1 = points[-1]
x, y = p2[0]-p1[0], p2[1]-p1[1]
s = [p1[0]+x/3, p1[1]+y/3]
t = [p1[0]+x*2/3, p1[1]+y*2/3]
r = (x**2 + y**2) ** 0.5 / 3
theta = math.atan(y/x) + math.pi/3
u = [s[0]+r*math.cos(theta), s[1]+r*math.sin(theta)]
if n == 1:
points.extend([s,u,t,p2])
else:
k... |
s752173868 | p02273 | u260980560 | 1501667410 | Python | Python3 | py | Runtime Error | 0 | 0 | 582 | from math import sqrt
q3 = sqrt(3)
fmt = "%.8f %.8f"
def koch(x0, y0, x1, y1, c):
xp = (x0*2 + x1) / 3
yp = (y0*2 + y1) / 3
xq = (x0 + x1*2) / 3
yq = (y0 + y1*2) / 3
dx = (x1 - x0) / 6
dy = (y1 - y0) / 6
xr = xp + (dx - dy * q3)
yr = yp + (dx * q3 + dy)
if c == n-1:
retur... |
s625479358 | p02273 | u846136461 | 1510475051 | Python | Python | py | Runtime Error | 0 | 0 | 1168 | import math
n = int(raw_input())
def vector_rot(vector, radian):
new_x = vector[0] * math.cos(radian) - vector[1] * math.sin(radian)
new_y = vector[0] * math.sin(radian) + vector[1] * math.cos(radian)
return [new_x, new_y]
def vector_add(v1, v2):
new_v = []
for i in range(2):
add = v1[i] + v2[i]
new_v.appen... |
s807626700 | p02273 | u846136461 | 1510475153 | Python | Python | py | Runtime Error | 0 | 0 | 1168 | import math
n = int(raw_input())
def vector_rot(vector, radian):
new_x = vector[0] * math.cos(radian) - vector[1] * math.sin(radian)
new_y = vector[0] * math.sin(radian) + vector[1] * math.cos(radian)
return [new_x, new_y]
def vector_add(v1, v2):
new_v = []
for i in range(2):
add = v1[i] + v2[i]
new_v.appen... |
s553030428 | p02273 | u152639966 | 1521823472 | Python | Python3 | py | Runtime Error | 0 | 0 | 491 | import numpy as np
n=int(input())
p1=[0,0]
p2=[100,0]
def Koch(d,p1,p2):
if d==0:
return
sx=(2*p1[0]+p2[0])/3
sy=(2*p1[1]+p2[1])/3
tx=(p1[0]+2*p2[0])/3
ty=(p1[1]+2*p2[1])/3
ux=(tx-sx)*np.cos(np.pi/3)-(ty-sy)*np.sin(np.pi/3)+sx
uy=(tx-sx)*np.cos(np.pi/3)+(ty-sy)*np.sin(np.pi/3)+sy
Koch(d-1,p1,[sx,sy])
... |
s141330935 | p02273 | u152639966 | 1521823617 | Python | Python3 | py | Runtime Error | 0 | 0 | 519 | import numpy as np
n=int(input())
p1=[float(0),float(0)]
p2=[float(100),float(0)]
def Koch(d,p1,p2):
if d==0:
return
sx=(2*p1[0]+p2[0])/3
sy=(2*p1[1]+p2[1])/3
tx=(p1[0]+2*p2[0])/3
ty=(p1[1]+2*p2[1])/3
ux=(tx-sx)*np.cos(np.pi/3)-(ty-sy)*np.sin(np.pi/3)+sx
uy=(tx-sx)*np.cos(np.pi/3)+(ty-sy)*np.sin(np.pi/3)+... |
s390251817 | p02273 | u196653484 | 1527155625 | Python | Python3 | py | Runtime Error | 0 | 0 | 980 | import math
from matplotlib import pyplot
class Dot:
x=0.0
y=0.0
def __init__(self,x,y):
self.x=x
self.y=y
def __lt__(self,other):
return self.x < other.x
def print(self):
x=self.x
y=self.y
print("{:.8f} {:.8f}".format(x,y))
def kock(n,a,b,dots)... |
s476159247 | p02273 | u609614788 | 1527601666 | Python | Python3 | py | Runtime Error | 0 | 0 | 708 | #include<iostream>
#include<cstdio>
#include<cmath>
int n;
Struct Point{
double x;
double y;
}
void calc(int m,Point p1,Point p2){
if(m>=n){
return;
}
Point s,t,u;
s.x=(2*p1.x+1*p2.x)/3.0;
s.y=(2*p1.y+1*p2.y)/3.0;
t.x=(1*p1.x+2*p2.x)/3.0;
s.y=(1*p1.y+2*p2.y)/3.0;
u.x=(t.x-s.x)*(1/2.0)-(t.y-s.y)*(sqrt(3)/2... |
s027944143 | p02273 | u609614788 | 1527601967 | Python | Python3 | py | Runtime Error | 0 | 0 | 721 | #include<iostream>
#include<cstdio>
#include<cmath>
int n;
struct Point{
double x;
double y;
};
void calc(int m,Point p1,Point p2){
if(m>=n){
return;
}
Point s,t,u;
s.x=(2*p1.x+1*p2.x)/3.0;
s.y=(2*p1.y+1*p2.y)/3.0;
t.x=(1*p1.x+2*p2.x)/3.0;
s.y=(1*p1.y+2*p2.y)/3.0;
u.x=(t.x-s.x)*(1/2.0)-(t.y-s.y)*(sqrt(3)/... |
s653003410 | p02273 | u609614788 | 1527602386 | Python | Python3 | py | Runtime Error | 0 | 0 | 732 | #include<iostream>
#include<cstdio>
#include<cmath>
int n;
struct Point{
double x;
double y;
};
void calc(int m,Point p1,Point p2){
if(m>=n){
return;
}
Point s,t,u;
s.x=(2.0*p1.x+p2.x)/3.0;
s.y=(2.0*p1.y+p2.y)/3.0;
t.x=(p1.x+2.0*p2.x)/3.0;
t.y=(p1.y+2.0*p2.y)/3.0;
u.x=(t.x-s.x)*(1.0/2.0)-(t.y-s.y)*(sqrt(3... |
s736131296 | p02273 | u481571686 | 1527661280 | Python | Python3 | py | Runtime Error | 0 | 0 | 699 | import math
n = int(input())
def koch(n,x_0,y_0,x_1,y_1):
if n == 0:
return
x_s = x_0 + (x_1- x_0)/3
y_s = y_0 + (y_1 -y_0)/3
x_t = x_0 + (x_1- x_0)* 2/3
y_t = y_0 + (y_1 -y_0) *2/3
x_u = (x_t - x_s) * math.cos(math.pi/3) - (y_t - y_s) * math.sin(math.pi/3) + x_s
y_u = (x_t ... |
s522971942 | p02273 | u404682284 | 1527925867 | Python | Python3 | py | Runtime Error | 0 | 0 | 621 | from math import sqrt
from numpy import array
def koch(n, start, end):
if n != 0:
vec = end - start
normal_vec = array([-vec[1], vec[0]])
a = start + vec/3
b = start + vec/2 + sqrt(3)*normal_vec/6
c = end - vec/3
koch(n-1, start, a)
print('{0:.5f} {1:.5f}'.fo... |
s097582082 | p02273 | u404682284 | 1527925920 | Python | Python3 | py | Runtime Error | 0 | 0 | 637 | from math import sqrt
from numpy import array
def koch(n, start, end):
if n != 0:
vec = end - start
normal_vec = array([-vec[1], vec[0]])
a = start + vec/3
b = start + vec/2 + sqrt(3)*normal_vec/6
c = end - vec/3
koch(n-1, start, a)
print('{0:.5f} {1:.5f}'.fo... |
s659698382 | p02273 | u404682284 | 1527925948 | Python | Python3 | py | Runtime Error | 0 | 0 | 635 | from math import sqrt
from numpy import array
def koch(n, start, end):
if n != 0:
vec = end - start
normal_vec = array([-vec[1], vec[0]])
a = start + vec/3
b = start + vec/2 + sqrt(3)*normal_vec/6
c = end - vec/3
koch(n-1, start, a)
print('{0:.5f} {1:.5f}'.fo... |
s647960569 | p02273 | u404682284 | 1527926222 | Python | Python3 | py | Runtime Error | 0 | 0 | 578 | from math import sqrt
from numpy import array
def koch(n, start, end):
if n != 0:
vec = end - start
normal_vec = array([-vec[1], vec[0]])
a = start + vec/3
b = start + vec/2 + sqrt(3)*normal_vec/6
c = end - vec/3
koch(n-1, start, a)
print(a[0], a[1])
... |
s429255703 | p02273 | u007270338 | 1528023656 | Python | Python3 | py | Runtime Error | 0 | 0 | 712 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
normAB = np.linalg.norm(AB)
D ... |
s912675409 | p02273 | u007270338 | 1528023872 | Python | Python3 | py | Runtime Error | 0 | 0 | 872 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
normAB = np.linalg.norm(AB)
D ... |
s742600329 | p02273 | u007270338 | 1528024104 | Python | Python3 | py | Runtime Error | 0 | 0 | 914 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
try:
n2 = input()
except:
pass
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, A... |
s570757480 | p02273 | u007270338 | 1528024171 | Python | Python3 | py | Runtime Error | 0 | 0 | 871 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
normAB = np.linalg.norm(AB)
D =... |
s933020325 | p02273 | u007270338 | 1528024750 | Python | Python3 | py | Runtime Error | 0 | 0 | 871 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
normAB = np.linalg.norm(AB)
D =... |
s927461778 | p02273 | u007270338 | 1528024796 | Python | Python3 | py | Runtime Error | 0 | 0 | 904 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
if n == 0:
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
nor... |
s150258212 | p02273 | u007270338 | 1528024881 | Python | Python3 | py | Runtime Error | 0 | 0 | 916 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
if n == 0:
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
nor... |
s849656790 | p02273 | u007270338 | 1528024967 | Python | Python3 | py | Runtime Error | 0 | 0 | 916 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
if n == 0:
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
nor... |
s625306241 | p02273 | u007270338 | 1528024999 | Python | Python3 | py | Runtime Error | 0 | 0 | 884 | #coding:utf-8
import numpy as np
import math
pi = math.pi
cos = math.cos
sin = math.sin
n = int(input())
A, B = np.array([0,0]), np.array([100,0])
def inc(A, B):
AB = B - A
rot = np.array([[cos(pi/2), -sin(pi/2)],[sin(pi/2), cos(pi/2)]])
convertedAB = np.dot(rot, AB)
normAB = np.linalg.norm(AB)
D =... |
s861932741 | p02273 | u912237403 | 1371341699 | Python | Python | py | Runtime Error | 0 | 0 | 555 | import math, cmath
def koch(p1, p2, n):
rad60 = math.pi/3
v1 = (p2 - p1)/3
v2 = cmath.rect(abs(v1), cmath.phase(v1)+rad60)
q1 = p1 + v1
q2 = q1 + v2
q3 = q1 + v1
if n == 1:
return [p1,q1,q2,q3,p2]
else:
x1 = koch(p1,q1,n-1)[1:-1]
x2 = koch(q1,q2,n-1)[1:-1]
... |
s080332170 | p02273 | u912237403 | 1371341932 | Python | Python | py | Runtime Error | 10 | 4444 | 567 | import math, cmath
def koch(p1, p2, n):
if n == 0:
return [p1, p2]
rad60 = math.pi/3
v1 = (p2 - p1)/3
v2 = cmath.rect(abs(v1), cmath.phase(v1)+rad60)
q1 = p1 + v1
q2 = q1 + v2
q3 = q1 + v1
if n == 1:
return [p1,q1,q2,q3,p2]
else:
x1 = koch(p1,q1,n-1)[-1]... |
s531408782 | p02274 | u792145349 | 1535245835 | Python | Python3 | py | Runtime Error | 20 | 5596 | 520 | N = int(input())
A = list(map(int, input().split()))
class BinaryIndexedTree:
def __init__(self, n):
self.size = n
self.bit = [0] * (n + 1)
def sum(self, i):
s = 0
while i > 0:
s += self.bit[i]
i -= (i & -i)
return s
def add(self, i, x):
... |
s719252766 | p02274 | u316584871 | 1535618402 | Python | Python3 | py | Runtime Error | 0 | 0 | 245 | rom collections import deque
n = int(input())
nd = deque(map(int, input().split()))
c = 0
for i in range(n):
m = min(nd)
s = nd.popleft()
if (s != m):
for k in nd:
if (k < s):
c += 1
print(c)
|
s516937431 | p02274 | u464296040 | 1535672817 | Python | Python3 | py | Runtime Error | 0 | 0 | 2617 | #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#incl... |
s039460182 | p02274 | u309159632 | 1540601968 | Python | Python3 | py | Runtime Error | 20 | 5596 | 552 | # 5
# 3 5 2 1 4
def cum(i):
res = 0
while i>0:
res += bit[i]
i -= i&-i
return res
def add(i, x):
while i<=N:
bit[i] += x
i += i&-i
def solve():
global N,A,bit
N = int(input())
A = list(map(int, input().split()))
bit = [0]*(N+1)
res = 0
for i in ... |
s674371504 | p02274 | u309159632 | 1540602094 | Python | Python3 | py | Runtime Error | 20 | 5600 | 459 | # 5
# 3 5 2 1 4
def cum(i):
res = 0
while i>0:
res += bit[i]
i -= i&-i
return res
def add(i, x):
while i<=N:
bit[i] += x
i += i&-i
def solve():
global N,A,bit
N = int(input())
A = list(map(int, input().split()))
bit = [0]*(N+1)
res = 0
for i in ... |
s391162721 | p02274 | u981699375 | 1546133354 | Python | Python3 | py | Runtime Error | 0 | 0 | 1442 | import std.array, std.stdio, std.conv, std.string, std.math, std.random, std.range,std.functional;
import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.comparison;
int count;
void main()
{
readln();
int[] list = readln().split.to!(int[]);
writeln(count);
}
int[... |
s248915853 | p02274 | u981699375 | 1546133617 | Python | Python3 | py | Runtime Error | 0 | 0 | 1464 | import std.array, std.stdio, std.conv, std.string, std.math, std.random, std.range,std.functional;
import std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.algorithm.comparison;
long count;
void main()
{
readln();
int[] list = readln().split.to!(int[]);
mergeSort(list);
wr... |
s413475351 | p02274 | u387603681 | 1556162142 | Python | Python3 | py | Runtime Error | 0 | 0 | 382 | global cnt = 0
def modify_order(A):
if len(A) < 2:
return
*B, hip, tail = A
if (hip > tail):
cnt += 1
return modify_order(B + [tail])+ [hip]
else:
return modify_order(B + [hip])+ [tail]
def sort(A):
if len(A) < 2:
return A
head, *B = modify_order(A)
return [head] + sort(B)
n = int(... |
s611186438 | p02274 | u797673668 | 1452485626 | Python | Python3 | py | Runtime Error | 30 | 7756 | 548 | class Bit:
def __init__(self, size):
self.arr = [0] * (size + 1)
self.size = size
def read(self, index):
sum_b = 0
while index:
sum_b += self.arr[index]
index &= index - 1
return sum_b
def update(self, index, value=1):
while index <= ... |
s180731852 | p02274 | u072053884 | 1453479642 | Python | Python3 | py | Runtime Error | 20 | 7784 | 525 | def num_of_inversions(A, n, cnt = 0):
"""Return the number of inversions in the sequence A.
A is a list of numbers.
n is the length of A.
cnt is a accumulator.
"""
if n == 1:
return cnt
t_cnt = 0
t_lt = A[-1]
for i in reversed(A[:n - 1]):
if i > t_lt:
t_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.