結果

問題 No.113 宝探し
コンテスト
ユーザー MitI_7
提出日時 2015-11-02 22:34:24
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 21 ms / 5,000 ms
+ 127µs
コード長 329 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 54 ms
コンパイル使用メモリ 15,232 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-09-25 00:54:32
合計ジャッジ時間 2,313 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import sqrt


def main():
    s = input()
    x, y, = 0, 0

    for d in s:
        if d == 'N':
            y += 1
        elif d == 'E':
            x -= 1
        elif d == 'W':
            x += 1
        elif d == 'S':
            y -= 1

    print(sqrt(x ** 2 + y ** 2))
    
if __name__ == '__main__':
    main()
0