結果

問題 No.1992 Tendon Walk
ユーザー Owlet
提出日時 2022-08-13 21:30:49
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 13,011 ms
コンパイル使用メモリ 387,420 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-25 01:39:58
合計ジャッジ時間 12,028 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line.");
    let x: i32 = input.trim().parse().unwrap();

    let m: [i32; 7] = [2, 2, -1, -1, 2, -1, -1];
    let mut m_max: u32 = 100;
    let mut z: i32 = 0;
    let mut ans: i32 = 0;

    'outer: while m_max > 0 {
        for v in m.iter() {
            z += v;
            ans += v.abs();
            if x == z {break 'outer};
        }
        m_max += 1;
    }

    println!("{}", ans);
}
0