結果

問題 No.1992 Tendon Walk
ユーザー GrayCoderGrayCoder
提出日時 2022-07-01 21:53:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 8,204 KB
最終ジャッジ日時 2023-08-17 09:26:02
合計ジャッジ時間 836 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,132 KB
testcase_01 AC 14 ms
8,204 KB
testcase_02 AC 15 ms
8,100 KB
testcase_03 AC 15 ms
8,156 KB
testcase_04 AC 16 ms
8,140 KB
testcase_05 AC 16 ms
8,136 KB
testcase_06 AC 16 ms
8,136 KB
testcase_07 AC 16 ms
8,116 KB
testcase_08 AC 15 ms
8,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import cycle
import sys


def main():
    input = lambda: sys.stdin.readline()[:-1]
    X = int(input())

    ab = (2, 2, -1, -1, 2, -1, -1)
    ans, x = 0, 0
    for n in cycle(ab):
        x += n
        ans += abs(n)
        if x == X:
            print(ans)
            break


if not __debug__:
    f = open(sys.argv[1], "r")
    sys.stdin = f


main()
0