結果

問題 No.1992 Tendon Walk
ユーザー Lisp_CoderLisp_Coder
提出日時 2022-12-24 01:12:47
言語 Go
(1.22.1)
結果
RE  
実行時間 -
コード長 365 bytes
コンパイル時間 10,382 ms
コンパイル使用メモリ 229,296 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-29 04:44:39
合計ジャッジ時間 11,026 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
    "fmt"
    "os"
    "strconv"
)

func main() {
    x, _ := strconv.Atoi(os.Args[1])

    d := []int{2, 2, -1, -1, 2, -1, -1}
    i := 0
    ans := 0
    for x != 0 {
        x += d[i]
        ans += abs(d[i])
        i = (i + 1) % 7
    }
    fmt.Println(ans)
}

func abs(x int) int {
    if x < 0 {
        return -x
    }
    return x
}
0