#13934:


10530826 (Starry Knight)

學校 : 臺北市立成功高級中學
編號 : 62083
來源 : [114.198.167.25]
最後登入時間 :
2020-11-14 10:15:59
c092. 00587 - There's treasure everywhere! -- UVa587 | From: [49.159.135.82] | 發表日期 : 2018-05-17 19:24

n = 0
while True:
n += 1
line = input()
if line == "END":
break
P = [0, 0]
Dir = line[:-1].split(',')
for i in range(len(Dir)):
for j in range(len(Dir[i])):
if ord(Dir[i][j]) > 57:
k = j
t = int(Dir[i][:k])
break
if Dir[i][k:] == 'N':
P[0] += t
elif Dir[i][k:] == 'S':
P[0] -= t
elif Dir[i][k:] == 'E':
P[1] += t
elif Dir[i][k:] == 'W':
P[1] -= t
elif Dir[i][k:] == 'NE':
P[0] += t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'SE':
P[0] -= t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'NW':
P[0] += t/(2**0.5)
P[1] -= t/(2**0.5)
else:
P[0] -= t/(2**0.5)
P[1] -= t/(2**0.5)
print("Map #" + str(n))
print("The treasure is located at (%.3f,%.3f)." % (P[1], P[0]))
print("The distance to the treasure is %.3f.\n" % (P[0]**2 + P[1]**2)**0.5)

 
#13935: Re:OLE


a0970580085@gmail.com (/)

學校 : 義守大學
編號 : 74647
來源 : [125.229.235.114]
最後登入時間 :
2023-08-30 17:36:04
c092. 00587 - There's treasure everywhere! -- UVa587 | From: [111.254.200.229] | 發表日期 : 2018-05-17 23:28

n = 0
while True:
n += 1
line = input()
if line == "END":
break
P = [0, 0]
Dir = line[:-1].split(',')
for i in range(len(Dir)):
for j in range(len(Dir[i])):
if ord(Dir[i][j]) > 57:
k = j
t = int(Dir[i][:k])
break
if Dir[i][k:] == 'N':
P[0] += t
elif Dir[i][k:] == 'S':
P[0] -= t
elif Dir[i][k:] == 'E':
P[1] += t
elif Dir[i][k:] == 'W':
P[1] -= t
elif Dir[i][k:] == 'NE':
P[0] += t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'SE':
P[0] -= t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'NW':
P[0] += t/(2**0.5)
P[1] -= t/(2**0.5)
else:
P[0] -= t/(2**0.5)
P[1] -= t/(2**0.5)
print("Map #" + str(n))
print("The treasure is located at (%.3f,%.3f)." % (P[1], P[0]))
print("The distance to the treasure is %.3f.\n" % (P[0]**2 + P[1]**2)**0.5)


應該是最後一組測資沒有空一行。

 
#13937: Re:OLE


a0970580085@gmail.com (/)

學校 : 義守大學
編號 : 74647
來源 : [125.229.235.114]
最後登入時間 :
2023-08-30 17:36:04
c092. 00587 - There's treasure everywhere! -- UVa587 | From: [111.254.200.229] | 發表日期 : 2018-05-18 00:12

n = 0
while True:
n += 1
line = input()
if line == "END":
break
P = [0, 0]
Dir = line[:-1].split(',')
for i in range(len(Dir)):
for j in range(len(Dir[i])):
if ord(Dir[i][j]) > 57:
k = j
t = int(Dir[i][:k])
break
if Dir[i][k:] == 'N':
P[0] += t
elif Dir[i][k:] == 'S':
P[0] -= t
elif Dir[i][k:] == 'E':
P[1] += t
elif Dir[i][k:] == 'W':
P[1] -= t
elif Dir[i][k:] == 'NE':
P[0] += t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'SE':
P[0] -= t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'NW':
P[0] += t/(2**0.5)
P[1] -= t/(2**0.5)
else:
P[0] -= t/(2**0.5)
P[1] -= t/(2**0.5)
print("Map #" + str(n))
print("The treasure is located at (%.3f,%.3f)." % (P[1], P[0]))
print("The distance to the treasure is %.3f.\n" % (P[0]**2 + P[1]**2)**0.5)


應該是最後一組測資沒有空一行。

我直接丟網路上大神的AC碼也是OLE。


 

 

經過我暴力測試,測資應該有14筆。

 
#15348: Re:OLE


hshua (hshua)

學校 : 新北市立林口高級中學
編號 : 52506
來源 : [125.228.147.181]
最後登入時間 :
2024-11-10 13:26:19
c092. 00587 - There's treasure everywhere! -- UVa587 | From: [61.219.36.116] | 發表日期 : 2018-09-30 08:57

n = 0
while True:
n += 1
line = input()
if line == "END":
break
P = [0, 0]
Dir = line[:-1].split(',')
for i in range(len(Dir)):
for j in range(len(Dir[i])):
if ord(Dir[i][j]) > 57:
k = j
t = int(Dir[i][:k])
break
if Dir[i][k:] == 'N':
P[0] += t
elif Dir[i][k:] == 'S':
P[0] -= t
elif Dir[i][k:] == 'E':
P[1] += t
elif Dir[i][k:] == 'W':
P[1] -= t
elif Dir[i][k:] == 'NE':
P[0] += t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'SE':
P[0] -= t/(2**0.5)
P[1] += t/(2**0.5)
elif Dir[i][k:] == 'NW':
P[0] += t/(2**0.5)
P[1] -= t/(2**0.5)
else:
P[0] -= t/(2**0.5)
P[1] -= t/(2**0.5)
print("Map #" + str(n))
print("The treasure is located at (%.3f,%.3f)." % (P[1], P[0]))
print("The distance to the treasure is %.3f.\n" % (P[0]**2 + P[1]**2)**0.5)


應該是最後一組測資沒有空一行。

我直接丟網路上大神的AC碼也是OLE。


 

 

經過我暴力測試,測資應該有14筆。


此題應該是嚴格檢測,最後最後不可以空行。

 
#21027: Re:OLE


k487237 (chenchen)

學校 : 國立臺中第一高級中學
編號 : 75487
來源 : [140.113.90.32]
最後登入時間 :
2020-04-15 01:15:32
c092. 00587 - There's treasure everywhere! -- UVa587 | From: [36.233.48.179] | 發表日期 : 2020-04-03 11:06

 

這題在 UVa 上面 最後要空行 不然會 Presentation error

在這裡反而最後不能空行 不然會 OLE

只能說這題剛好相反過來

或是說平常因為都不是嚴格模式所以沒差

不然平常都是 UVa 不能有空行

 
ZeroJudge Forum