結果

問題 No.113 宝探し
ユーザー Theta
提出日時 2022-10-21 19:36:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 459 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-07-01 04:54:21
合計ジャッジ時間 1,991 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt


def main():
    S = input()

    destination = [0, 0]
    for direction in S:
        match direction:
            case "N":
                destination[1] += 1
            case "S":
                destination[1] -= 1
            case "E":
                destination[0] += 1
            case "W":
                destination[0] -= 1

    print(sqrt(destination[0] ** 2 + destination[1] ** 2))


if __name__ == "__main__":
    main()
0