結果

問題 No.1992 Tendon Walk
ユーザー testtest
提出日時 2022-11-23 13:58:25
言語 JavaScript
(node v20.8.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 5,232 KB
実行使用メモリ 37,516 KB
最終ジャッジ日時 2023-10-24 23:22:45
合計ジャッジ時間 2,000 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
37,516 KB
testcase_01 AC 68 ms
37,516 KB
testcase_02 AC 67 ms
37,516 KB
testcase_03 AC 66 ms
37,516 KB
testcase_04 AC 64 ms
37,516 KB
testcase_05 AC 65 ms
37,516 KB
testcase_06 AC 64 ms
37,516 KB
testcase_07 AC 65 ms
37,516 KB
testcase_08 AC 65 ms
37,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
    const x = parseInt(input.replace("\n", ""));
    const ab = [2, 2, -1, -1, 2, -1, -1];
    let p = 0;
    let d = 0;
    let ans = 0;
    for (let i = 0; i < 100; i++) {
        d = ab[i % 7]
        p += d;
        ans += Math.abs(d);
        if (p == x) break;
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0