提出 #58707720


ソースコード 拡げる

import math

n = int(input())
x, y = [], []

for i in range(n):
    xi, yi = map(int, input().split())
    x.append(xi)
    y.append(yi)

distance = math.sqrt(x[0]**2 + y[0]**2)
for i in range(n-1):
    distance += math.sqrt((x[i] - x[i + 1])**2 + (y[i] - y[i + 1])**2)

distance+= math.sqrt(x[n-1]**2 + y[n-1]**2)

print(distance)

提出情報

提出日時
問題 B - Traveling Takahashi Problem
ユーザ MrBlack005
言語 Python (PyPy 3.10-v7.3.12)
得点 150
コード長 351 Byte
結果 AC
実行時間 156 ms
メモリ 95356 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 150 / 150
結果
AC × 3
AC × 14
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 146 ms 94648 KiB
random_02.txt AC 113 ms 89944 KiB
random_03.txt AC 145 ms 94808 KiB
random_04.txt AC 95 ms 86596 KiB
random_05.txt AC 156 ms 94660 KiB
random_06.txt AC 92 ms 85164 KiB
random_07.txt AC 156 ms 94324 KiB
random_08.txt AC 77 ms 82156 KiB
random_09.txt AC 60 ms 76604 KiB
random_10.txt AC 59 ms 76628 KiB
random_11.txt AC 150 ms 95356 KiB
sample_01.txt AC 58 ms 76512 KiB
sample_02.txt AC 58 ms 76736 KiB
sample_03.txt AC 59 ms 76424 KiB