s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s844278401 | p02381 | u213265973 | 1494482145 | Python | Python3 | py | Runtime Error | 0 | 0 | 231 | import math
while True:
n = int(input())
score = [ int(i) for i in input().split(" ") ]
average = sum(score) / float(n)
if n == 0:
break
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / float(n) ) | File "/tmp/tmpp4doo0ry/tmpljq0hhfs.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / float(n) )
^
SyntaxError: '(' was never closed
| |
s401391156 | p02381 | u213265973 | 1494482172 | Python | Python3 | py | Runtime Error | 0 | 0 | 235 | import math
while True:
n = int(input())
score = [ int(i) for i in input().split(" ") ]
average = sum(score) / float(n)
if n == 0:
break
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / float(n) ) | File "/tmp/tmp22yumzcb/tmptqrjlnc6.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / float(n) )
^
SyntaxError: '(' was never closed
| |
s781295569 | p02381 | u213265973 | 1494482207 | Python | Python3 | py | Runtime Error | 0 | 0 | 235 | import math
while True:
n = int(input())
score = [ int(i) for i in input().split(" ") ]
average = sum(score) / float(n)
if n == 0:
break
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / float(n) ) | File "/tmp/tmpljl4w161/tmp4dnm_ifn.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / float(n) )
^
SyntaxError: '(' was never closed
| |
s260288673 | p02381 | u213265973 | 1494482245 | Python | Python3 | py | Runtime Error | 0 | 0 | 221 | import math
while True:
n = int(input())
score = [ int(i) for i in input().split(" ") ]
average = sum(score) / n
if n == 0:
break
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / n ) | File "/tmp/tmp3bl177te/tmp83iss4yf.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / n )
^
SyntaxError: '(' was never closed
| |
s977167149 | p02381 | u213265973 | 1494482291 | Python | Python3 | py | Runtime Error | 0 | 0 | 221 | import math
while True:
n = int(input())
if n == 0:
break
score = [ int(i) for i in input().split(" ") ]
average = sum(score) / n
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / n ) | File "/tmp/tmpujkaadws/tmpqzqhkjvr.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / n )
^
SyntaxError: '(' was never closed
| |
s052578065 | p02381 | u213265973 | 1494482432 | Python | Python3 | py | Runtime Error | 0 | 0 | 217 | import math
while True:
n = int(input())
if n == 0:
break
score = [int(i) for i in input().split(" ")]
average = sum(score) / n
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / n ) | File "/tmp/tmpum4hmbze/tmpg6g6vu8m.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-average) ** 2]) / n )
^
SyntaxError: '(' was never closed
| |
s197701469 | p02381 | u213265973 | 1494482487 | Python | Python3 | py | Runtime Error | 0 | 0 | 197 | import math
while True:
n = int(input())
if n == 0:
break
s = [int(i) for i in input().split(" ")]
m = sum(s) / n
print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2]) / n ) | File "/tmp/tmpkh6a_n0s/tmpldj0c58d.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2]) / n )
^
SyntaxError: '(' was never closed
| |
s679335420 | p02381 | u213265973 | 1494482499 | Python | Python3 | py | Runtime Error | 0 | 0 | 196 | import math
while True:
n = int(input())
if n == 0:
break
s = [int(i) for i in input().split(" ")]
m = sum(s) / n
print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2]) / n) | File "/tmp/tmprcyboyoj/tmpfl49e1ae.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2]) / n)
^
SyntaxError: '(' was never closed
| |
s606347766 | p02381 | u213265973 | 1494482754 | Python | Python3 | py | Runtime Error | 0 | 0 | 207 | import math
while True:
n = int(input())
if n == 0:
break
s = [int(i) for i in input().split(" ")]
m = sum(s) / n
print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2 for x in s]) / n) | File "/tmp/tmplx44xaq5/tmppai1vviq.py", line 8
print("{:.8f}".format(math.sqrt(sum([(x-m) ** 2 for x in s]) / n)
^
SyntaxError: '(' was never closed
| |
s940283587 | p02381 | u603049633 | 1495866492 | Python | Python3 | py | Runtime Error | 0 | 0 | 237 | import math
def hensa(n, S):
m = sum(S)/n
x = 0
for i in S:
x += (i - m) ** 2
hensa = math.sqrt(x / n)
return hensa
n = 1
while n != 0:
n = int(input())
S = list(map(int, input().split()))
print("{0:04f}".format(hensa(n, S))) | Traceback (most recent call last):
File "/tmp/tmpukfbxiie/tmp2v2n44o_.py", line 13, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s415686525 | p02381 | u650790815 | 1496461163 | Python | Python3 | py | Runtime Error | 0 | 0 | 119 | n = int(input())
d = list(map(int,input().split()))
import math
m = sum(d) / n
print(math.sqrt( (x-m)**2/n for x in d)) | Traceback (most recent call last):
File "/tmp/tmpuym5_9cq/tmpttvgx5ke.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s609309628 | p02381 | u350064373 | 1501147315 | Python | Python3 | py | Runtime Error | 0 | 0 | 166 | import statistics
while True:
x = input()
if x == 0:
break
else:
ls = list(map(int, input().split()))
print(statistics.pstdev(ls)) | Traceback (most recent call last):
File "/tmp/tmp9dqgk5oj/tmp7s_ufwg0.py", line 3, in <module>
x = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s049054554 | p02381 | u350064373 | 1501147387 | Python | Python3 | py | Runtime Error | 0 | 0 | 184 | import statistics
while True:
x = input()
if x == 0:
break
else:
ls = list(map(int, input().split()))
print("{0:.8f}".format(statistics.pstdev(ls))) | Traceback (most recent call last):
File "/tmp/tmphui0s62x/tmp6n4wger3.py", line 3, in <module>
x = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s945842299 | p02381 | u498511622 | 1501147952 | Python | Python3 | py | Runtime Error | 0 | 0 | 164 | import statistics
while True:
s=int(input())
if s==0:
break
else:
lst=list(map(int,input().split()))
print("{0.8}".format(statitics.pstdev(lst)))
| Traceback (most recent call last):
File "/tmp/tmp18j8sbky/tmpvu64cx3a.py", line 4, in <module>
s=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s004290736 | p02381 | u498511622 | 1501147992 | Python | Python3 | py | Runtime Error | 0 | 0 | 165 | import statistics
while True:
s=int(input())
if s==0:
break
else:
lst=list(map(int,input().split()))
print("{0:.8}".format(statitics.pstdev(lst)))
| Traceback (most recent call last):
File "/tmp/tmp31v9kn3q/tmp4bdwonx1.py", line 4, in <module>
s=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s439102780 | p02381 | u311299757 | 1501388382 | Python | Python3 | py | Runtime Error | 0 | 0 | 142 | from statistics import pstdev
while True:
if input() == 0: break
v_list = (int(x) for x in input().split())
print(pstdev(v_list)) | Traceback (most recent call last):
File "/tmp/tmpy7in3sk4/tmp6hf9qn6z.py", line 4, in <module>
if input() == 0: break
^^^^^^^
EOFError: EOF when reading a line
| |
s006408252 | p02381 | u666221014 | 1505125492 | Python | Python3 | py | Runtime Error | 0 | 0 | 157 | import numpy as np
while True:
num = int(input())
if num == 0: break
array = np.array(list(map(float, input().split())))
print(np.std(array)) | Traceback (most recent call last):
File "/tmp/tmphvraq3mb/tmpdqks53_q.py", line 3, in <module>
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s987280857 | p02381 | u666221014 | 1505125575 | Python | Python3 | py | Runtime Error | 0 | 0 | 162 | import numpy as np
while True:
num = int(input())
if num == 0: break
array = np.array(list(map(float, input().split())))
print(str(np.std(array))) | Traceback (most recent call last):
File "/tmp/tmpxcj4qdmk/tmp9ex04r4r.py", line 3, in <module>
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s469743079 | p02381 | u933096856 | 1505444607 | Python | Python3 | py | Runtime Error | 0 | 0 | 130 | import bumpy as np
while True:
n= int(input())
if n == 0:
break
a=map(int, input().split())
print(np.std(a) | File "/tmp/tmpe17elwby/tmpmmu5oxlu.py", line 4
if n == 0:
^
IndentationError: unindent does not match any outer indentation level
| |
s668151733 | p02381 | u933096856 | 1505444628 | Python | Python3 | py | Runtime Error | 0 | 0 | 130 | import numpy as np
while True:
n= int(input())
if n == 0:
break
a=map(int, input().split())
print(np.std(a) | File "/tmp/tmpv3x7wlk4/tmp4g7rt_4g.py", line 4
if n == 0:
^
IndentationError: unindent does not match any outer indentation level
| |
s655203615 | p02381 | u933096856 | 1505444644 | Python | Python3 | py | Runtime Error | 0 | 0 | 131 | import numpy as np
while True:
n= int(input())
if n == 0:
break
a=map(int, input().split())
print(np.std(a)) | File "/tmp/tmpz0bad9li/tmp78a4owy5.py", line 4
if n == 0:
^
IndentationError: unindent does not match any outer indentation level
| |
s809981831 | p02381 | u933096856 | 1505444661 | Python | Python3 | py | Runtime Error | 0 | 0 | 132 | import numpy as np
while True:
n= int(input())
if n == 0:
break
a=map(int, input().split())
print(np.std(a)) | Traceback (most recent call last):
File "/tmp/tmpksocz12r/tmpz514mw5m.py", line 3, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s803660929 | p02381 | u933096856 | 1505445001 | Python | Python3 | py | Runtime Error | 0 | 0 | 130 | import numpy as np
while True:
n= int(input())
if n == 0:
break
print(np.std(list(map(int, input().split())))) | Traceback (most recent call last):
File "/tmp/tmpva8yiafr/tmpxg0_ptzo.py", line 3, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s001455621 | p02381 | u933096856 | 1505445110 | Python | Python3 | py | Runtime Error | 0 | 0 | 148 | import numpy as np
while True:
n= int(input())
if n == 0:
break
print(np.std(list(map(int, input().split())), dtype=np.float64)) | Traceback (most recent call last):
File "/tmp/tmp996p_ros/tmpmsqalk0s.py", line 3, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s483609979 | p02381 | u933096856 | 1505445162 | Python | Python3 | py | Runtime Error | 0 | 0 | 148 | import numpy as np
while True:
n= int(input())
if n == 0:
break
print(np.std(list(map(int, input().split())), dtype=np.float64)) | Traceback (most recent call last):
File "/tmp/tmpi7ihz30h/tmp6dmeys3d.py", line 3, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s958078037 | p02381 | u933096856 | 1505445574 | Python | Python3 | py | Runtime Error | 0 | 0 | 223 | import numpy as np
import math
while True:
n= int(input())
if n == 0:
break
a=list(map(int,input().split()))
m=np.mean(a)
s=0
for i in a:
s+=(i-m)**2
s/=n
print(math.sqrt(s)) | Traceback (most recent call last):
File "/tmp/tmprrtkv2le/tmpx4ahxcdc.py", line 4, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s163322376 | p02381 | u933096856 | 1505445727 | Python | Python3 | py | Runtime Error | 0 | 0 | 240 | import numpy as np
import math
while True:
n= int(input())
if n == 0:
break
a=list(map(int,input().split()))
m=np.mean(a)
s=0
for i in a:
s+=(i-m)**2
s/=n
print("{0:.8f}".format(math.sqrt(s))) | Traceback (most recent call last):
File "/tmp/tmpszx4a_l9/tmpgefz2g8t.py", line 4, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s440112183 | p02381 | u933096856 | 1505445777 | Python | Python3 | py | Runtime Error | 0 | 0 | 241 | import numpy as np
import math
while True:
n= int(input())
if n == 0:
quit()
a=list(map(int,input().split()))
m=np.mean(a)
s=0
for i in a:
s+=(i-m)**2
s/=n
print("{0:.8f}".format(math.sqrt(s))) | Traceback (most recent call last):
File "/tmp/tmp9dwdpdsr/tmp6uxsdy57.py", line 4, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s187120309 | p02381 | u933096856 | 1505479115 | Python | Python3 | py | Runtime Error | 0 | 0 | 242 | import numpy as np
import math
while True:
n= int(input())
if n == 0:
break
a=list(map(float,input().split()))
m=np.mean(a)
s=0
for i in a:
s+=(i-m)**2
s/=n
print("{0:.8f}".format(math.sqrt(s))) | Traceback (most recent call last):
File "/tmp/tmpyckh3k__/tmp2diorng1.py", line 4, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s564416269 | p02381 | u933096856 | 1505479136 | Python | Python3 | py | Runtime Error | 0 | 0 | 241 | import numpy as np
import math
while True:
n= int(input())
if n == 0:
break
a=list(map(float,input().split())
m=np.mean(a)
s=0
for i in a:
s+=(i-m)**2
s/=n
print("{0:.8f}".format(math.sqrt(s))) | File "/tmp/tmp_g_xph0o/tmpml369ij2.py", line 7
a=list(map(float,input().split())
^
SyntaxError: '(' was never closed
| |
s449278068 | p02381 | u933096856 | 1505479143 | Python | Python3 | py | Runtime Error | 0 | 0 | 242 | import numpy as np
import math
while True:
n= int(input())
if n == 0:
break
a=list(map(float,input().split()))
m=np.mean(a)
s=0
for i in a:
s+=(i-m)**2
s/=n
print("{0:.8f}".format(math.sqrt(s))) | Traceback (most recent call last):
File "/tmp/tmpu2nym4vz/tmpobzrhbqj.py", line 4, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s048230974 | p02381 | u933096856 | 1505479236 | Python | Python3 | py | Runtime Error | 0 | 0 | 242 | import numpy as np
import math
while True:
n= int(input())
if n == 0:
break
a=list(map(float,input().split()))
m=np.mean(a)
s=0
for i in a:
s+=(i-m)**2
s/=n
print("{0:.8f}".format(math.sqrt(s))) | Traceback (most recent call last):
File "/tmp/tmpxfp6a2xl/tmpmwyiwhlk.py", line 4, in <module>
n= int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s700134844 | p02381 | u518939641 | 1510404163 | Python | Python3 | py | Runtime Error | 0 | 0 | 109 | import numpy as np
while input()!='0':
print('%.8f'%(np.std(np.array(list(map(float,input().split())))))) | Traceback (most recent call last):
File "/tmp/tmpn28de8wd/tmpypxyism2.py", line 2, in <module>
while input()!='0':
^^^^^^^
EOFError: EOF when reading a line
| |
s478736238 | p02381 | u406002631 | 1514029527 | Python | Python3 | py | Runtime Error | 0 | 0 | 201 | import numpy as np
while True:
n = int(input())
if n == 0:
break
s = list(map(int, input().split()))
for i in range(n):
std = np.std(s)
print("{0:.8f}".format(std)) | Traceback (most recent call last):
File "/tmp/tmp3_1gqcsn/tmpmvdh90a4.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s802890302 | p02381 | u406002631 | 1514029640 | Python | Python3 | py | Runtime Error | 0 | 0 | 201 | import numpy as np
while True:
n = int(input())
if n == 0:
break
s = list(map(int, input().split()))
for i in range(n):
std = np.std(s)
print("{0:.8f}".format(std)) | Traceback (most recent call last):
File "/tmp/tmpmnl4c_zv/tmpj4l0ldwo.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s358770919 | p02381 | u406002631 | 1514029810 | Python | Python3 | py | Runtime Error | 0 | 0 | 216 | import numpy as np
while True:
n = int(input())
if n == 0:
break
s = list(map(int, input().split()))
for i in range(n):
std = np.std(s)
print("{0:.8f}".format(std), end="\n")
| Traceback (most recent call last):
File "/tmp/tmp43463fbw/tmpojt259p0.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s120101893 | p02381 | u406002631 | 1514029974 | Python | Python3 | py | Runtime Error | 0 | 0 | 206 | import numpy as np
while True:
n = int(input())
if n == 0:
break
s = list(map(int, input().split()))
for i in range(n):
std = np.std(s)
print("{0:.8f}".format(std))
| Traceback (most recent call last):
File "/tmp/tmp7jkd5hwu/tmpfsqgrr76.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s197979549 | p02381 | u426534722 | 1515943552 | Python | Python3 | py | Runtime Error | 0 | 0 | 166 | from statistics import pstdev
while True:
data_count = int(input())
if data_count == 0:
break
print(pstdev(sum(int(x) for x in input().split())))
| Traceback (most recent call last):
File "/tmp/tmpgmdyaq5m/tmpj5diakxr.py", line 3, in <module>
data_count = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s582128064 | p02381 | u017523606 | 1516165857 | Python | Python3 | py | Runtime Error | 0 | 0 | 227 | n = int(input())
data = input().split()
import math
sum = 0
for i in range(n):
sum = sum + int(data[I])
average = sum / n
a = 0
for i in range(n):
a = a + (int(data[i]) - average)**2
print('{}'.format(math.sqrt(a/n)))
| Traceback (most recent call last):
File "/tmp/tmp_ivswm5x/tmp_smymddm.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s131512065 | p02381 | u017523606 | 1516166079 | Python | Python3 | py | Runtime Error | 0 | 0 | 303 | while True:
n = int(input())
if n == 0:
break
data = input().split()
import math
sum = 0
for i in range(n):
sum = sum + int(data[i])
average = sum / n
a = 0
for i in range(n):
a = a + (int(data[i]) - average)**2
print('{}'.format(math.sqrt(a/n)))
| File "/tmp/tmpyf1tud2m/tmp31t5c7y2.py", line 9
sum = sum + int(data[i])
^
IndentationError: expected an indented block after 'for' statement on line 8
| |
s472749767 | p02381 | u150984829 | 1516366691 | Python | Python3 | py | Runtime Error | 0 | 0 | 113 | while input():
s=list(map(int,input().split()))
n=len(s)
a=sum(s)/n
print((sum([x*x for x in s])/n-a*a)**.5)
| Traceback (most recent call last):
File "/tmp/tmpnqo50flo/tmp6lddyuc3.py", line 1, in <module>
while input():
^^^^^^^
EOFError: EOF when reading a line
| |
s323265814 | p02381 | u150984829 | 1516366811 | Python | Python3 | py | Runtime Error | 0 | 0 | 115 | while input()>0:
s=list(map(int,input().split()))
n=len(s)
a=sum(s)/n
print((sum([x*x for x in s])/n-a*a)**.5)
| Traceback (most recent call last):
File "/tmp/tmp_mwrqb8c/tmptzuj0x36.py", line 1, in <module>
while input()>0:
^^^^^^^
EOFError: EOF when reading a line
| |
s157477294 | p02381 | u536089081 | 1517532013 | Python | Python3 | py | Runtime Error | 0 | 0 | 162 | import numpy as np
while True:
num = int(input())
if num == 0:
break
data = np.array(list(map(int, input().split())))
print(np.std(data))
| Traceback (most recent call last):
File "/tmp/tmph8xfrkp4/tmpqyc5x9h5.py", line 3, in <module>
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s971096633 | p02381 | u613534067 | 1520344061 | Python | Python3 | py | Runtime Error | 0 | 0 | 222 | import math
while(True):
if input() == '0':
break
a = map(int, input().split())
m = sum(a) / len(a)
b = 0
for i in a:
b += (i - m) ** 2.0
stddev = math.sqrt(b / n)
print(stddev)
| Traceback (most recent call last):
File "/tmp/tmpu2296976/tmpyqwiww0s.py", line 3, in <module>
if input() == '0':
^^^^^^^
EOFError: EOF when reading a line
| |
s875347633 | p02381 | u613534067 | 1520344076 | Python | Python3 | py | Runtime Error | 0 | 0 | 228 | import math
while(True):
if input() == '0':
break
a = list(map(int, input().split()))
m = sum(a) / len(a)
b = 0
for i in a:
b += (i - m) ** 2.0
stddev = math.sqrt(b / n)
print(stddev)
| Traceback (most recent call last):
File "/tmp/tmpk60q6880/tmpkpe10fdv.py", line 3, in <module>
if input() == '0':
^^^^^^^
EOFError: EOF when reading a line
| |
s901697160 | p02381 | u682153677 | 1524375510 | Python | Python3 | py | Runtime Error | 0 | 0 | 180 | # -*- coding: utf-8 -*-
from statistics import stdev
while True:
n = int(input())
if n == 0:
break
s = list(map(int, input().split()))
print(stdev(s))
| Traceback (most recent call last):
File "/tmp/tmpmx32jghc/tmp4qyxddp9.py", line 6, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s289178962 | p02381 | u682153677 | 1524376126 | Python | Python3 | py | Runtime Error | 0 | 0 | 325 | # -*- coding: utf-8 -*-
import math
while True:
n = int(input())
if n == 0:
break
s = list(map(float, input().split()))
mean = sum(s) / len(s)
for i in range(len(s)):
s[i] = (s[i] - sum) * (s[i] - sum)
variance = sum(s) / len(s)
stdev = math.sqrt(variance)
print(stdev)
| Traceback (most recent call last):
File "/tmp/tmpu70zdpea/tmpory32lw3.py", line 6, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s969165680 | p02381 | u603663339 | 1524736195 | Python | Python3 | py | Runtime Error | 0 | 0 | 165 | import numpy as np
while 1:
N = int(input())
if N == 0:
break
xs = np.array(list(map(int, input().split())))
print(np.sqrt(np.var(xs)))
| Traceback (most recent call last):
File "/tmp/tmpgwxm8c44/tmpz_6zk48j.py", line 3, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s603964161 | p02381 | u603663339 | 1524736247 | Python | Python3 | py | Runtime Error | 0 | 0 | 165 | import numpy as np
while 1:
N = int(input())
if N == 0:
break
xs = np.array(list(map(int, input().split())))
print(np.sqrt(np.var(xs)))
| Traceback (most recent call last):
File "/tmp/tmpksr6c7jr/tmpmbn_aacm.py", line 3, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s519647506 | p02381 | u603663339 | 1524736320 | Python | Python3 | py | Runtime Error | 0 | 0 | 165 | import numpy as np
while 1:
N = int(input())
if N == 0:
break
xs = np.array(list(map(int, input().split())))
print(np.sqrt(np.var(xs)))
| Traceback (most recent call last):
File "/tmp/tmpcjkxufvx/tmpj7vd7pj7.py", line 3, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s179818557 | p02381 | u603663339 | 1524737116 | Python | Python3 | py | Runtime Error | 0 | 0 | 175 | import numpy as np
while 1:
N = int(input())
if N == 0:
break
xs = np.array(list(map(int, input().split())))
print(xs)
print(np.sqrt(np.var(xs)))
| Traceback (most recent call last):
File "/tmp/tmpimmownzn/tmptfmzax3b.py", line 4, in <module>
N = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s074912798 | p02381 | u603663339 | 1524737602 | Python | Python3 | py | Runtime Error | 0 | 0 | 71 | while 1:
N = int(input())
if N == 0:
break
print(0)
| File "/tmp/tmph0jdhwh3/tmpxqm10rsr.py", line 5
print(0)
^
IndentationError: unindent does not match any outer indentation level
| |
s541716110 | p02381 | u843169619 | 1525905162 | Python | Python3 | py | Runtime Error | 0 | 0 | 178 | import statistics as st
while True:
n = float(input())
if n == 0:
break
scores = list(map(float, input().split()))
std = st.stdev(scores)
print(std)
| Traceback (most recent call last):
File "/tmp/tmp_jhws9da/tmp24peazoq.py", line 4, in <module>
n = float(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s686212816 | p02381 | u986478725 | 1527350668 | Python | Python3 | py | Runtime Error | 0 | 0 | 504 | # AOJ ITP1_10_C
import math
def intinput():
a = input().split()
for i in range(len(a)):
a[i] = int(a[i])
return a
def main():
while True:
n = int(input())
if n == 0: break
data = intinput()
sum_1 = 0 # 1乗の総和
sum_2 = 0 # 2乗の総和
for i in range(n):
sum_1 += data[i]; sum_2 += data[i] ** 2
sigma = math.sqrt((sum_2 - (sum_1 ** 2)) / n)
print(sigma)
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmpv7ymlb3i/tmpc7y9w6hm.py", line 24, in <module>
main()
File "/tmp/tmpv7ymlb3i/tmpc7y9w6hm.py", line 13, in main
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s156580448 | p02381 | u912237403 | 1371253842 | Python | Python | py | Runtime Error | 0 | 0 | 210 | while True:
n = int(raw_input())
if n == 0: break
for i in range(n):
x = map(int, raw_input().split())
ave = sum(x) / n
std = (sum([(e-ave)**2 for e in x])/n)**0.5
print std | File "/tmp/tmpw7bxxfwe/tmpg_wpxryh.py", line 9
print std
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s514115339 | p02381 | u140201022 | 1382374978 | Python | Python | py | Runtime Error | 0 | 0 | 394 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import io
import re
import math
while True:
# i = 0
n = int(raw_input())
l = map(float, raw_input().split())
if n==0: break
# hyojunhensa**2 = sum(tokuten-heikinten)**2)/ninzu
avg=sum(l)/len(l)
print avg
naka=0
for i in l:
print naka
naka+=(i-avg)**2
hyo2 = naka/n
print (hyo2)**0.5 | File "/tmp/tmp76xl1xcf/tmp0wsjti1x.py", line 15
print avg
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s136689750 | p02381 | u140201022 | 1382375060 | Python | Python | py | Runtime Error | 0 | 0 | 387 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import io
import re
import math
while True:
n = int(raw_input())
l = map(float, raw_input().split())
if n==0:
break
# hyojunhensa**2 = sum(tokuten-heikinten)**2)/ninzu
avg=sum(l)/len(l)
print avg
naka=0
for i in l:
print naka
naka+=(i-avg)**2
hyo2 = naka/n
print (hyo2)**0.5 | File "/tmp/tmpq81x6ggt/tmp_tfidl7p.py", line 12
break
^
IndentationError: expected an indented block after 'if' statement on line 11
| |
s649280901 | p02381 | u140201022 | 1382375220 | Python | Python | py | Runtime Error | 0 | 0 | 361 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import io
import re
import math
while True:
# i = 0
n = int(raw_input())
l = map(float, raw_input().split())
if n==0: break
# hyojunhensa**2 = sum(tokuten-heikinten)**2)/ninzu
avg=sum(l)/len(l)
naka=0
for i in l:
naka+=(i-avg)**2
hyo2 = naka/n
print (hyo2)**0.5 | Traceback (most recent call last):
File "/tmp/tmp_fa51pfe/tmppcl1daco.py", line 10, in <module>
n = int(raw_input())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s021235682 | p02382 | u435313013 | 1559180177 | Python | Python3 | py | Runtime Error | 0 | 0 | 551 | import math
class Triangle(object):
def __init__(self, a, b, C):
self.a = a
self.b = b
self.C = math.radians(C)
def getArea(self):
return((self.a * self.getHeight()) / 2)
def getPerimeter(self):
return(self.a + self.b + math.sqrt(self.a ** 2 + self.b ** 2 - 2 * self.a * self.b * math.cos(self.C)))
def getHeight(self):
return(self.b * math.sin(self.C))
tri = Triangle(*[int(i) for i in input().split()])
print(tri.getArea())
print(tri.getPerimeter())
print(tri.getHeight())
| Traceback (most recent call last):
File "/tmp/tmppze0w39g/tmpv93u1dmf.py", line 17, in <module>
tri = Triangle(*[int(i) for i in input().split()])
^^^^^^^
EOFError: EOF when reading a line
| |
s178660829 | p02382 | u297342993 | 1423702343 | Python | Python3 | py | Runtime Error | 0 | 0 | 325 | import math
input()
vx = [int(i) for i in input().split()]
vy = [int(i) for i in input().split()]
Dxy = []
for p in range(1, 4):
Dxy.append(sum([abs(xv[i] - vy[i]) ** p for i in range(len(vx))]) ** (1 / p))
Dxy.append(max([abs(vx[i] - vy[i]) for i in range(len(vx))]))
for res in Dxy:
print('{0:5f}'.format(res)) | Traceback (most recent call last):
File "/tmp/tmpl_dnn39f/tmpulgrvms3.py", line 3, in <module>
input()
EOFError: EOF when reading a line
| |
s384706246 | p02382 | u811841526 | 1449090921 | Python | Python3 | py | Runtime Error | 0 | 0 | 419 | def manhattan(xs, ys):
d = sum([abs(x-y) for x, y in zip(xs, ys)])
return d
def euclid(xs, ys):
return math.sqrt(sum([(x-y)**2 for x, y in zip(xs, ys)]))
def chev(xs, ys):
return max([abs(x-y) for x, y in zip(xs, ys)])
def norm():
n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(manhattan(xs, ys), euclid(xs, ys), chev(xs, ys))
norm() | Traceback (most recent call last):
File "/tmp/tmpr68p21ks/tmpk2b7cgqu.py", line 17, in <module>
norm()
File "/tmp/tmpr68p21ks/tmpk2b7cgqu.py", line 12, in norm
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s306800642 | p02382 | u811841526 | 1449090996 | Python | Python3 | py | Runtime Error | 0 | 0 | 419 | def manhattan(xs, ys):
d = sum([abs(x-y) for x, y in zip(xs, ys)])
return d
def euclid(xs, ys):
return math.sqrt(sum([(x-y)**2 for x, y in zip(xs, ys)]))
def chev(xs, ys):
return max([abs(x-y) for x, y in zip(xs, ys)])
def norm():
n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(manhattan(xs, ys), euclid(xs, ys), chev(xs, ys))
norm() | Traceback (most recent call last):
File "/tmp/tmpvms0jdvk/tmpybum22b6.py", line 17, in <module>
norm()
File "/tmp/tmpvms0jdvk/tmpybum22b6.py", line 12, in norm
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s197007549 | p02382 | u811841526 | 1449091187 | Python | Python3 | py | Runtime Error | 0 | 0 | 528 | def manhattan(xs, ys):
return sum([abs(x-y) for x, y in zip(xs, ys)])
def euclid(xs, ys):
return math.sqrt(sum([(x-y)**2 for x, y in zip(xs, ys)]))
def l3(xs, ys):
return (sum([(x-y)*** for x, y in zip(xs, ys)]))**(1/3)
def chev(xs, ys):
return max([abs(x-y) for x, y in zip(xs, ys)])
def norm():
n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(manhattan(xs, ys))
print(euclid(xs, ys))
print(l3(xs, ys))
print(chev(xs, ys))
norm() | File "/tmp/tmpfut00aug/tmp8dbhamwx.py", line 8
return (sum([(x-y)*** for x, y in zip(xs, ys)]))**(1/3)
^
SyntaxError: invalid syntax
| |
s669624711 | p02382 | u811841526 | 1449091254 | Python | Python3 | py | Runtime Error | 0 | 0 | 211 | n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(manhattan(xs, ys))
print(euclid(xs, ys))
print(l3(xs, ys))
print(chev(xs, ys))
norm() | File "/tmp/tmpo6tmftf5/tmppiwadd31.py", line 1
n = int(input())
IndentationError: unexpected indent
| |
s876707525 | p02382 | u811841526 | 1449091270 | Python | Python3 | py | Runtime Error | 0 | 0 | 183 | n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(manhattan(xs, ys))
print(euclid(xs, ys))
print(l3(xs, ys))
print(chev(xs, ys))
norm() | Traceback (most recent call last):
File "/tmp/tmprgacoxku/tmpek8fbi5g.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s560723960 | p02382 | u811841526 | 1449091294 | Python | Python3 | py | Runtime Error | 0 | 0 | 98 | n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
norm() | Traceback (most recent call last):
File "/tmp/tmpkkbyqysw/tmpwg5ld0qn.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s451124738 | p02382 | u811841526 | 1449091350 | Python | Python3 | py | Runtime Error | 0 | 0 | 299 | n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(sum([abs(x-y) for x, y in zip(xs, ys)]))
print(math.sqrt(sum([(x-y)**2 for x, y in zip(xs, ys)])))
print((sum([(x-y)*** for x, y in zip(xs, ys)]))**(1/3))
print(max([abs(x-y) for x, y in zip(xs, ys)])) | File "/tmp/tmpydjkbrp5/tmpjrzblkmd.py", line 7
print((sum([(x-y)*** for x, y in zip(xs, ys)]))**(1/3))
^
SyntaxError: invalid syntax
| |
s564804370 | p02382 | u811841526 | 1449091390 | Python | Python3 | py | Runtime Error | 0 | 0 | 299 | n = int(input())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
print(sum([abs(x-y) for x, y in zip(xs, ys)]))
print(math.sqrt(sum([(x-y)**2 for x, y in zip(xs, ys)])))
print((sum([(x-y)**3 for x, y in zip(xs, ys)]))**(1/3))
print(max([abs(x-y) for x, y in zip(xs, ys)])) | Traceback (most recent call last):
File "/tmp/tmpv4kpg5fa/tmpde1cde9s.py", line 1, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s250332653 | p02382 | u396164240 | 1449716934 | Python | Python | py | Runtime Error | 0 | 0 | 601 | inf = float('inf')
def distance(p,n,x,y):
D = 0.0
s = []
for i in range(0,n):
s.append(x[i]-y[i])
if s[i]<0.0:
s[i]*=-1.0
D += s[i]**p
if p==inf:
return max(s)
else:
return D**(1.0/p)
if __name__ == '__main__':
n = int(input())
x = []
y = []
for i in range(0,n):
x.append(int(input()))
for i in range(0,n):
y.append(int(input()))
print float(distance(1,n,x,y))
print float(distance(2,n,x,y))
print float(distance(3,n,x,y))
print float(distance(inf,n,x,y)) | File "/tmp/tmpvf79d32a/tmpjwyc40kx.py", line 27
print float(distance(1,n,x,y))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s435987860 | p02382 | u396164240 | 1449717022 | Python | Python | py | Runtime Error | 0 | 0 | 685 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 10 11:31:39 2015
@author: Ryuhei
"""
inf = float('inf')
def distance(p,n,x,y):
D = 0
s = []
for i in range(0,n):
s.append(x[i]-y[i])
if s[i]<0.0:
s[i]*=-1.0
D += s[i]**p
if p==inf:
return max(s)
else:
return D**(1.0/p)
if __name__ == '__main__':
n = int(input())
x = []
y = []
for i in range(0,n):
x.append(int(input()))
for i in range(0,n):
y.append(int(input()))
print float(distance(1,n,x,y))
print float(distance(2,n,x,y))
print float(distance(3,n,x,y))
print float(distance(inf,n,x,y)) | File "/tmp/tmp2bhd1fnn/tmp2t4k4tbf.py", line 34
print float(distance(1,n,x,y))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s485425563 | p02382 | u670498238 | 1463700129 | Python | Python3 | py | Runtime Error | 0 | 0 | 317 | import math
n = int(input)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for p in range(1, 4):
D = []
for count in range(n):
D.append((math.fabs(A[count] - B[count]))** p)
if p == 1:
di = max(D)
d = (sum(D)) ** (1/p)
print('%.06f' %d)
print('%.06f' % di) | Traceback (most recent call last):
File "/tmp/tmpxyhtkuj0/tmpjye7tpbz.py", line 2, in <module>
n = int(input)
^^^^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
| |
s693137962 | p02382 | u216425054 | 1471445206 | Python | Python3 | py | Runtime Error | 0 | 0 | 275 | n=int(input())
vector1=[int(x) for x in input().split()]
vector2=[int(x) for x in input().split()]
for i in range(1,4):
print("{0:.8f}".format(sum([abs(a-b)**p for a,b in zip(vector1,vector2)])**(1/p)))
print("{0:.8f}".format(max([abs(a-b) for a,b in zip(vector1,vector2)]))) | File "/tmp/tmp11na6czs/tmpql32sr_a.py", line 5
print("{0:.8f}".format(sum([abs(a-b)**p for a,b in zip(vector1,vector2)])**(1/p)))
^
IndentationError: expected an indented block after 'for' statement on line 4
| |
s330131002 | p02382 | u216425054 | 1471445244 | Python | Python3 | py | Runtime Error | 0 | 0 | 283 | n=int(input())
vector1=[int(x) for x in input().split()]
vector2=[int(x) for x in input().split()]
for i in range(1,4):
print("{0:.8f}".format(sum([abs(a-b)**p for a,b in zip(vector1,vector2)])**(1/p)))
print("{0:.8f}".format(max([abs(a-b) for a,b in zip(vector1,vector2)]))) | Traceback (most recent call last):
File "/tmp/tmppebqkdmp/tmpspw9qq0w.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s015857628 | p02382 | u216425054 | 1471445289 | Python | Python3 | py | Runtime Error | 0 | 0 | 283 | n=int(input())
vector1=[int(x) for x in input().split()]
vector2=[int(x) for x in input().split()]
for i in range(1,4):
print("{0:.8f}".format(sum([abs(a-b)**p for a,b in zip(vector1,vector2)])**(1/i)))
print("{0:.8f}".format(max([abs(a-b) for a,b in zip(vector1,vector2)]))) | Traceback (most recent call last):
File "/tmp/tmpquhkqg7l/tmpd5q3o0ib.py", line 1, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s548326748 | p02382 | u998435601 | 1473608502 | Python | Python3 | py | Runtime Error | 0 | 0 | 288 | import math
n = int(input())
x = list(map(int, raw_input().split()))
y = list(map(int, raw_input().split()))
t1 = t2 = t3 = ti = 0.0
for a, b in zip(x, y):
d1 = abs(a - b)
ti = max(ti, d1)
t1 += d1
t2 += d1**2
t3 += d1**3
print(t1)
print(math.sqrt(t2))
print(t3 ** (1.0/3))
print(ti) | Traceback (most recent call last):
File "/tmp/tmpfa_bzfih/tmp7tj65wvp.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s174215143 | p02382 | u391228754 | 1476167679 | Python | Python3 | py | Runtime Error | 30 | 7808 | 415 | import math
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
p1, p2, p3, p4 = 0, 0, 0, 0
hyp = 0
for i in range(n):
p1 += math.fabs(a1[i] -a2[i])
p2 += (a1[i]-a2[i])**2
p3 += math.fabs((a1[i]-a2[i])**3)
hyp = math.fabs(a1[i] -a2[i])
if hyp > p4:
p4 = hyp
p2 = math.sqrt(p2)
p3 = math.exp(math.log(p3)/3)
print(p1)
print(p2)
print(p3)
print(p4) | Traceback (most recent call last):
File "/tmp/tmp_h2oqd00/tmp5ogazz83.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s544656945 | p02382 | u175111751 | 1477795955 | Python | Python3 | py | Runtime Error | 0 | 0 | 270 | import math
n = int(input())
x, y = [list(map(int, input().split())) for _ in range(2)]
for p in (1,2,3,math.inf):
if p == math.inf:
print(max(abs(x-y) for x, y in zip(x,y)))
else:
print(math.pow(sum(abs(x-y) ** p for x, y in zip(x,y)), 1.0 / p)) | Traceback (most recent call last):
File "/tmp/tmppfvgh5z6/tmpo5k5fm_y.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s929241306 | p02382 | u801346721 | 1479048099 | Python | Python3 | py | Runtime Error | 0 | 0 | 297 | import math
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for p in range(1, 4):
sum = 0
for i in range(n):
sum += math.fabs(x[i]-y[i])**p
print(sum**(1/p))
sum = 0
for i in range(n):
sum += math.fabs(x[[i]-y[i])**math.inf
print(sum**(1/math.inf)) | File "/tmp/tmpy0jd1ied/tmpkr0mu2pj.py", line 14
sum += math.fabs(x[[i]-y[i])**math.inf
^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
| |
s395759136 | p02382 | u801346721 | 1479048602 | Python | Python3 | py | Runtime Error | 0 | 0 | 288 | import math
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for p in range(1, 4):
sum = 0
for i in range(n):
sum += math.fabs(x[i]-y[i])**p
print(sum**(1/p))
a = []
for i in range(n):
a.append(math.fabs(x[i]-y[i]))
a = a.sort()
print(a[n]) | Traceback (most recent call last):
File "/tmp/tmpcougsaac/tmp0zvs4xbe.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s639354067 | p02382 | u801346721 | 1479048630 | Python | Python3 | py | Runtime Error | 0 | 0 | 290 | import math
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for p in range(1, 4):
sum = 0
for i in range(n):
sum += math.fabs(x[i]-y[i])**p
print(sum**(1/p))
a = []
for i in range(n):
a.append(math.fabs(x[i]-y[i]))
a = a.sort()
print(a[n-1]) | Traceback (most recent call last):
File "/tmp/tmpak50zvq5/tmpxq1_8b6r.py", line 2, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s127059877 | p02382 | u811733736 | 1480640993 | Python | Python3 | py | Runtime Error | 0 | 0 | 988 | import math
def calc_minkowski_distance(data_x, data_y, types):
# ???????´???????????¨???????map???????????¬??????????????????????????¨????????¨????????§?¶???????????????????????????§????????????????????????
distance = list(map(lambda x, y:abs(x - y), data_x, data_y))
results = []
for t in types:
if t == math.inf:
results.append(max(distance))
else:
temp = map(lambda x:math.pow(x, t), distance)
total = sum(temp)
results.append(math.pow(total, 1.0/t))
return results
if __name__ == '__main__':
# ??????????????\???
# data_x = [1, 2, 3]
# data_y = [2, 0, 4]
num = int(input())
data_x = [int(x) for x in input().split(' ')]
data_y = [int(x) for x in input().split(' ')]
# ???????????????
types = [1, 2, 3, math.inf]
results = calc_minkowski_distance(data_x, data_y, types)
# ???????????¨???
for r in results:
print('{0:.6f}'.format(r)) | Traceback (most recent call last):
File "/tmp/tmph5zrhrec/tmp0dpfqxlo.py", line 23, in <module>
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s290712383 | p02382 | u811733736 | 1480641077 | Python | Python3 | py | Runtime Error | 0 | 0 | 988 | import math
def calc_minkowski_distance(data_x, data_y, types):
# ???????´???????????¨???????map???????????¬??????????????????????????¨????????¨????????§?¶???????????????????????????§????????????????????????
distance = list(map(lambda x, y:abs(x - y), data_x, data_y))
results = []
for t in types:
if t == math.inf:
results.append(max(distance))
else:
temp = map(lambda x:math.pow(x, t), distance)
total = sum(temp)
results.append(math.pow(total, 1.0/t))
return results
if __name__ == '__main__':
# ??????????????\???
# data_x = [1, 2, 3]
# data_y = [2, 0, 4]
num = int(input())
data_x = [int(x) for x in input().split(' ')]
data_y = [int(x) for x in input().split(' ')]
# ???????????????
types = [1, 2, 3, math.inf]
results = calc_minkowski_distance(data_x, data_y, types)
# ???????????¨???
for r in results:
print('{0:.8f}'.format(r)) | Traceback (most recent call last):
File "/tmp/tmpe8nbf_ro/tmpsbaqp0dn.py", line 23, in <module>
num = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s365821387 | p02382 | u042885182 | 1493906967 | Python | Python3 | py | Runtime Error | 0 | 0 | 2550 | # coding: utf-8
# Here your code !
import sys
import collections
import math
import unittest
def calculate_minkowski_distances():
lines = sys.stdin.readlines()[1:]
data = []
for line in lines:
data.append([ float(value) for value in line.rstrip().split() ])
for exponent in (1, 2, 3, math.inf):
print(minkowski_distance(*data, exponent))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if math.isinf(exponent) :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
def __input_error():
print("input error")
return -1
class __TestValueClass(unittest.TestCase):
def testEqual(self, func, tuples, eff_digit = math.nan, print_success = False):
self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
#tuples[index] = ([*arguments of func], compared value)
for item in tuples:
try:
if isinstance(item[0], collections.Iterable):
value = func(*item[0])
else:
value = func(item[0])
if math.isnan(eff_digit) :
assertfunc(value,item[1])
else :
format_str = "{0:."+str(eff_digit)+"g}"
assertfunc(format_str.format(value),format_str.format(item[1]))
except Exception as msg:
swidth = 15
print("="*50)
print("-- Assertion Error in '" + func.__name__ + "' --")
print("arguments".ljust(swidth)+":",item[0])
print("compared value".ljust(swidth)+":",item[1])
print("message".ljust(swidth)+":")
print(msg)
sys.exit()
if print_success :
print(func.__name__,": succeeded")
#test
if __name__ == "__main__" :
test = __TestValueClass()
vec_x = [1, 2, 3]
vec_y = [2, 0, 4]
test.testEqual(minkowski_distance, [([vec_x, vec_y, 1], 4), ([vec_x, vec_y, 2], 2.449490)], eff_digit = 5)
test.testEqual(minkowski_distance, [([vec_x, vec_y, 3], 2.154435), ([vec_x, vec_y, math.inf], 2)], eff_digit = 5)#, print_success = True)
calculate_minkowski_distances()
| ==================================================
-- Assertion Error in 'minkowski_distance' --
arguments : [[1, 2, 3], [2, 0, 4], 1]
compared value : 4
message :
module 'collections' has no attribute 'Iterable'
| |
s501237017 | p02382 | u042885182 | 1493907123 | Python | Python3 | py | Runtime Error | 0 | 0 | 2552 | # coding: utf-8
# Here your code !
import sys
import collections
import math
import unittest
def calculate_minkowski_distances():
lines = sys.stdin.readlines()[1:]
data = []
for line in lines:
data.append([ float(value) for value in line.rstrip().split() ])
for exponent in (1, 2, 3, math.inf):
print(minkowski_distance(*data, exponent))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if math.isinf(exponent) :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
def __input_error():
print("input error")
return -1
class __TestValueClass(unittest.TestCase):
def testEqual(self, func, tuples, eff_digit = math.nan, print_success = False):
self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
#tuples[index] = ([*arguments of func], compared value)
for item in tuples:
try:
if isinstance(item[0], collections.Iterable):
value = func(*item[0])
else:
value = func(item[0])
if math.isnan(eff_digit) :
assertfunc(value,item[1])
else :
format_str = "{0:."+str(eff_digit)+"g}"
assertfunc(format_str.format(value),format_str.format(item[1]))
except Exception as msg:
swidth = 15
print("="*50)
print("-- Assertion Error in '" + func.__name__ + "' --")
print("arguments".ljust(swidth)+":",item[0])
print("compared value".ljust(swidth)+":",item[1])
print("message".ljust(swidth)+":")
print(msg)
sys.exit()
if print_success :
print(func.__name__,": succeeded")
#test
if __name__ == "__main__" :
test = __TestValueClass()
vec_x = [1, 2, 3]
vec_y = [2, 0, 4]
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 1], 4), ([vec_x, vec_y, 2], 2.449490)], eff_digit = 5)
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 3], 2.154435), ([vec_x, vec_y, math.inf], 2)], eff_digit = 5)#, print_success = True)
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpx5z6qhc4/tmp7uj1cjsh.py", line 75, in <module>
calculate_minkowski_distances()
File "/tmp/tmpx5z6qhc4/tmp7uj1cjsh.py", line 16, in calculate_minkowski_distances
print(minkowski_distance(*data, exponent))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: minkowski_distance() missing 2 required positional arguments: 'vector_y' and 'exponent'
| |
s317361699 | p02382 | u042885182 | 1493907176 | Python | Python3 | py | Runtime Error | 0 | 0 | 777 | # coding: utf-8
# Here your code !
import sys
import math
def calculate_minkowski_distances():
lines = sys.stdin.readlines()[1:]
data = []
for line in lines:
data.append([ float(value) for value in line.rstrip().split() ])
for exponent in (1, 2, 3, math.inf):
print(minkowski_distance(*data, exponent))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if math.isinf(exponent) :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
#test
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpx5c0j3l5/tmp6d_bcrj_.py", line 31, in <module>
calculate_minkowski_distances()
File "/tmp/tmpx5c0j3l5/tmp6d_bcrj_.py", line 14, in calculate_minkowski_distances
print(minkowski_distance(*data, exponent))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: minkowski_distance() missing 2 required positional arguments: 'vector_y' and 'exponent'
| |
s516416776 | p02382 | u042885182 | 1493907436 | Python | Python3 | py | Runtime Error | 0 | 0 | 2678 | # coding: utf-8
# Here your code !
import sys
import collections
import math
import unittest
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
# lines = sys.stdin.readlines()[1:]
# for line in lines:
# data.append([ float(value) for value in line.rstrip().split() ])
for exponent in (1, 2, 3, math.inf):
print(minkowski_distance(*data, exponent))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if math.isinf(exponent) :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
'''
def __input_error():
print("input error")
return -1
class __TestValueClass(unittest.TestCase):
def testEqual(self, func, tuples, eff_digit = math.nan, print_success = False):
self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
#tuples[index] = ([*arguments of func], compared value)
for item in tuples:
try:
if isinstance(item[0], collections.Iterable):
value = func(*item[0])
else:
value = func(item[0])
if math.isnan(eff_digit) :
assertfunc(value,item[1])
else :
format_str = "{0:."+str(eff_digit)+"g}"
assertfunc(format_str.format(value),format_str.format(item[1]))
except Exception as msg:
swidth = 15
print("="*50)
print("-- Assertion Error in '" + func.__name__ + "' --")
print("arguments".ljust(swidth)+":",item[0])
print("compared value".ljust(swidth)+":",item[1])
print("message".ljust(swidth)+":")
print(msg)
sys.exit()
if print_success :
print(func.__name__,": succeeded")
'''
#test
if __name__ == "__main__" :
# test = __TestValueClass()
# vec_x = [1, 2, 3]
# vec_y = [2, 0, 4]
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 1], 4), ([vec_x, vec_y, 2], 2.449490)], eff_digit = 5)
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 3], 2.154435), ([vec_x, vec_y, math.inf], 2)], eff_digit = 5)#, print_success = True)
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpq8zedbuc/tmpl3apdl1y.py", line 79, in <module>
calculate_minkowski_distances()
File "/tmp/tmpq8zedbuc/tmpl3apdl1y.py", line 10, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s160387027 | p02382 | u042885182 | 1493907493 | Python | Python3 | py | Runtime Error | 0 | 0 | 738 | # coding: utf-8
# Here your code !
import math
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
for exponent in (1, 2, 3, math.inf):
print(minkowski_distance(*data, exponent))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if math.isinf(exponent) :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpv0kcjh06/tmphk4x_zvn.py", line 28, in <module>
calculate_minkowski_distances()
File "/tmp/tmpv0kcjh06/tmphk4x_zvn.py", line 6, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s110260565 | p02382 | u042885182 | 1493907618 | Python | Python3 | py | Runtime Error | 0 | 0 | 2696 | # coding: utf-8
# Here your code !
import sys
import collections
import math
import unittest
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
# lines = sys.stdin.readlines()[1:]
# for line in lines:
# data.append([ float(value) for value in line.rstrip().split() ])
for exponent in (1, 2, 3, math.inf):
print("{0:.6f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if math.isinf(exponent) :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
'''
def __input_error():
print("input error")
return -1
class __TestValueClass(unittest.TestCase):
def testEqual(self, func, tuples, eff_digit = math.nan, print_success = False):
self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
#tuples[index] = ([*arguments of func], compared value)
for item in tuples:
try:
if isinstance(item[0], collections.Iterable):
value = func(*item[0])
else:
value = func(item[0])
if math.isnan(eff_digit) :
assertfunc(value,item[1])
else :
format_str = "{0:."+str(eff_digit)+"g}"
assertfunc(format_str.format(value),format_str.format(item[1]))
except Exception as msg:
swidth = 15
print("="*50)
print("-- Assertion Error in '" + func.__name__ + "' --")
print("arguments".ljust(swidth)+":",item[0])
print("compared value".ljust(swidth)+":",item[1])
print("message".ljust(swidth)+":")
print(msg)
sys.exit()
if print_success :
print(func.__name__,": succeeded")
'''
#test
if __name__ == "__main__" :
# test = __TestValueClass()
# vec_x = [1, 2, 3]
# vec_y = [2, 0, 4]
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 1], 4), ([vec_x, vec_y, 2], 2.449490)], eff_digit = 5)
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 3], 2.154435), ([vec_x, vec_y, math.inf], 2)], eff_digit = 5)#, print_success = True)
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpkeh6gyt2/tmp303ne1ua.py", line 79, in <module>
calculate_minkowski_distances()
File "/tmp/tmpkeh6gyt2/tmp303ne1ua.py", line 10, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s075055740 | p02382 | u042885182 | 1493907682 | Python | Python3 | py | Runtime Error | 0 | 0 | 765 | # coding: utf-8
# Here your code !
import math
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
for exponent in (1, 2, 3, math.inf):
print("{0:.6f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if math.isinf(exponent) :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
#test
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpqj112m8p/tmpt1n_5vzc.py", line 29, in <module>
calculate_minkowski_distances()
File "/tmp/tmpqj112m8p/tmpt1n_5vzc.py", line 6, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s093112675 | p02382 | u042885182 | 1493907745 | Python | Python3 | py | Runtime Error | 0 | 0 | 2704 | # coding: utf-8
# Here your code !
import sys
import collections
#import math
import unittest
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
# lines = sys.stdin.readlines()[1:]
# for line in lines:
# data.append([ float(value) for value in line.rstrip().split() ])
for exponent in (1, 2, 3, float("inf")):
print("{0:.6f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if exponent == float("inf") :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
'''
def __input_error():
print("input error")
return -1
class __TestValueClass(unittest.TestCase):
def testEqual(self, func, tuples, eff_digit = math.nan, print_success = False):
self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
#tuples[index] = ([*arguments of func], compared value)
for item in tuples:
try:
if isinstance(item[0], collections.Iterable):
value = func(*item[0])
else:
value = func(item[0])
if math.isnan(eff_digit) :
assertfunc(value,item[1])
else :
format_str = "{0:."+str(eff_digit)+"g}"
assertfunc(format_str.format(value),format_str.format(item[1]))
except Exception as msg:
swidth = 15
print("="*50)
print("-- Assertion Error in '" + func.__name__ + "' --")
print("arguments".ljust(swidth)+":",item[0])
print("compared value".ljust(swidth)+":",item[1])
print("message".ljust(swidth)+":")
print(msg)
sys.exit()
if print_success :
print(func.__name__,": succeeded")
'''
#test
if __name__ == "__main__" :
# test = __TestValueClass()
# vec_x = [1, 2, 3]
# vec_y = [2, 0, 4]
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 1], 4), ([vec_x, vec_y, 2], 2.449490)], eff_digit = 5)
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 3], 2.154435), ([vec_x, vec_y, math.inf], 2)], eff_digit = 5)#, print_success = True)
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpl531l85q/tmpzcvvxa1u.py", line 78, in <module>
calculate_minkowski_distances()
File "/tmp/tmpl531l85q/tmpzcvvxa1u.py", line 9, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s631139524 | p02382 | u042885182 | 1493907797 | Python | Python3 | py | Runtime Error | 0 | 0 | 751 | # coding: utf-8
# Here your code !
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
for exponent in (1, 2, 3, float("inf")):
print("{0:.6f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if exponent == float("inf") :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpn9epegll/tmpj37_pip3.py", line 26, in <module>
calculate_minkowski_distances()
File "/tmp/tmpn9epegll/tmpj37_pip3.py", line 5, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s823732413 | p02382 | u042885182 | 1493907995 | Python | Python3 | py | Runtime Error | 0 | 0 | 2704 | # coding: utf-8
# Here your code !
import sys
import collections
#import math
import unittest
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
# lines = sys.stdin.readlines()[1:]
# for line in lines:
# data.append([ float(value) for value in line.rstrip().split() ])
for exponent in (1, 2, 3, float("inf")):
print("{0:.8f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if exponent == float("inf") :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
'''
def __input_error():
print("input error")
return -1
class __TestValueClass(unittest.TestCase):
def testEqual(self, func, tuples, eff_digit = math.nan, print_success = False):
self.testFunction(self.assertEqual,func,tuples,eff_digit,print_success)
def testFunction(self,assertfunc,func,tuples,eff_digit,print_success):
#tuples[index] = ([*arguments of func], compared value)
for item in tuples:
try:
if isinstance(item[0], collections.Iterable):
value = func(*item[0])
else:
value = func(item[0])
if math.isnan(eff_digit) :
assertfunc(value,item[1])
else :
format_str = "{0:."+str(eff_digit)+"g}"
assertfunc(format_str.format(value),format_str.format(item[1]))
except Exception as msg:
swidth = 15
print("="*50)
print("-- Assertion Error in '" + func.__name__ + "' --")
print("arguments".ljust(swidth)+":",item[0])
print("compared value".ljust(swidth)+":",item[1])
print("message".ljust(swidth)+":")
print(msg)
sys.exit()
if print_success :
print(func.__name__,": succeeded")
'''
#test
if __name__ == "__main__" :
# test = __TestValueClass()
# vec_x = [1, 2, 3]
# vec_y = [2, 0, 4]
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 1], 4), ([vec_x, vec_y, 2], 2.449490)], eff_digit = 5)
# test.testEqual(minkowski_distance, [([vec_x, vec_y, 3], 2.154435), ([vec_x, vec_y, math.inf], 2)], eff_digit = 5)#, print_success = True)
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmp930ukz5e/tmpc1cvczan.py", line 78, in <module>
calculate_minkowski_distances()
File "/tmp/tmp930ukz5e/tmpc1cvczan.py", line 9, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s073944273 | p02382 | u042885182 | 1493908052 | Python | Python3 | py | Runtime Error | 0 | 0 | 752 | # coding: utf-8
# Here your code !
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
for exponent in (1, 2, 3, float("inf")):
print("{0:.8f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
m_dis = 0
if exponent == float("inf") :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmp5d_7j24e/tmppac3afdo.py", line 27, in <module>
calculate_minkowski_distances()
File "/tmp/tmp5d_7j24e/tmppac3afdo.py", line 5, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s377524951 | p02382 | u042885182 | 1493908155 | Python | Python3 | py | Runtime Error | 0 | 0 | 833 | # coding: utf-8
# Here your code !
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
for exponent in (1, 2, 3, float("inf")):
print("{0:.8f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
# abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
abs_xy = [abs(vector_x[i] - vector_y[i]) for i in range(len(vector_x))]
m_dis = 0
if exponent == float("inf") :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpmndeu_lq/tmprmwp0r8k.py", line 28, in <module>
calculate_minkowski_distances()
File "/tmp/tmpmndeu_lq/tmprmwp0r8k.py", line 5, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s250254614 | p02382 | u042885182 | 1493908641 | Python | Python3 | py | Runtime Error | 0 | 0 | 885 | # coding: utf-8
# Here your code !
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([float(value) for value in input().rstrip().split()])
for exponent in (1, 2, 3, float("inf")):
print(minkowski_distance(*data, exponent))
# print("{0:.8f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
# abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
abs_xy = [abs(vector_x[i] - vector_y[i]) for i in range(len(vector_x))]
m_dis = 0
if exponent == float("inf") :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = ( sum([ elem**exponent for elem in abs_xy ])**(1/exponent) )
return m_dis
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmpxt7hk18k/tmp5hh8fisw.py", line 29, in <module>
calculate_minkowski_distances()
File "/tmp/tmpxt7hk18k/tmp5hh8fisw.py", line 5, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s498195797 | p02382 | u042885182 | 1493908817 | Python | Python3 | py | Runtime Error | 0 | 0 | 879 | # coding: utf-8
# Here your code !
def calculate_minkowski_distances():
_ = input()
data = []
for i in range(2):
data.append([int(value) for value in input().rstrip().split()])
for exponent in (1, 2, 3, float("inf")):
print(minkowski_distance(*data, exponent))
# print("{0:.8f}".format(minkowski_distance(*data, exponent)))
def minkowski_distance(vector_x, vector_y, exponent):
# abs_xy = [ abs(pair[0] - pair[1]) for pair in zip(vector_x, vector_y) ]
abs_xy = [abs(vector_x[i] - vector_y[i]) for i in range(len(vector_x))]
m_dis = 0
if exponent == float("inf") :
m_dis = max(abs_xy)
elif exponent == 0 :
m_dis = nan
else :
m_dis = sum([ elem**exponent for elem in abs_xy ])**(1/exponent)
return m_dis
if __name__ == "__main__" :
calculate_minkowski_distances()
| Traceback (most recent call last):
File "/tmp/tmp46ufh2n0/tmp_boaw4ww.py", line 29, in <module>
calculate_minkowski_distances()
File "/tmp/tmp46ufh2n0/tmp_boaw4ww.py", line 5, in calculate_minkowski_distances
_ = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s480162518 | p02382 | u623167544 | 1494385218 | Python | Python3 | py | Runtime Error | 20 | 7664 | 488 |
def dis_func(n, x, y):
dis = [round(0, 6) for i in range(n+1)]
for x, y in zip(x, y):
tmp = abs(x - y)
dis[0] += tmp
dis[1] += (tmp ** 2)
dis[2] += (tmp ** 3)
dis[3] = max(dis[3], tmp)
dis[1] = dis[1] ** (1/2)
dis[2] = dis[2] ** (1/3)
print('\n'.join(list(map(str, dis))))
if __name__ == '__main__':
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
dis_func(n, x, y) | Traceback (most recent call last):
File "/tmp/tmpiwz4zm_l/tmpi441xqns.py", line 18, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s077852593 | p02382 | u213265973 | 1494484011 | Python | Python3 | py | Runtime Error | 0 | 0 | 307 | n = int(input())
X = [int(i) for i in input().split(" ")]
Y = [int(i) for i in input().split(" ")]
#p = 1,2,3
for p in range(1, 4):
print("{:.6f}".format(sum( [abs(a - b) ** p) for a, b in zip(X,Y) ] ) ** (1 / p) ) )
#p = infinity
print("{:.6f}".format(max( [ abs(a - b) for a, b in zip(X, Y) ] ) ) )
| File "/tmp/tmpkqch4w2q/tmp07nhtz6q.py", line 7
print("{:.6f}".format(sum( [abs(a - b) ** p) for a, b in zip(X,Y) ] ) ** (1 / p) ) )
^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
| |
s508480958 | p02382 | u213265973 | 1494484024 | Python | Python3 | py | Runtime Error | 0 | 0 | 282 | n = int(input())
X = [int(i) for i in input().split(" ")]
Y = [int(i) for i in input().split(" ")]
for p in range(1, 4):
print("{:.6f}".format(sum( [abs(a - b) ** p) for a, b in zip(X,Y) ] ) ** (1 / p) ) )
print("{:.6f}".format(max( [ abs(a - b) for a, b in zip(X, Y) ] ) ) )
| File "/tmp/tmph0d6z4n5/tmpcg0z47p7.py", line 6
print("{:.6f}".format(sum( [abs(a - b) ** p) for a, b in zip(X,Y) ] ) ** (1 / p) ) )
^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
| |
s830928063 | p02382 | u213265973 | 1494484085 | Python | Python3 | py | Runtime Error | 0 | 0 | 283 | n = int(input())
X = [int(i) for i in input().split(" ")]
Y = [int(i) for i in input().split(" ")]
for p in range(1, 4):
print("{:.6f}".format(sum( [abs(a - b) ** p) for a, b in zip(X,Y) ] ) ** (1 / p) ) )
print("{:.6f}".format(max( [ abs(a - b) for a, b in zip(X, Y) ] ) ) )
| File "/tmp/tmpm0l1xa71/tmpfwpdpnz7.py", line 6
print("{:.6f}".format(sum( [abs(a - b) ** p) for a, b in zip(X,Y) ] ) ** (1 / p) ) )
^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.