結果

問題 No.740 幻の木
コンテスト
ユーザー phspls
提出日時 2022-12-04 17:09:44
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 525 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,672 ms
コンパイル使用メモリ 188,704 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-28 04:44:52
合計ジャッジ時間 4,191 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

fn main() {
    let mut temp = String::new();
    std::io::stdin().read_line(&mut temp).ok();
    let temp: Vec<usize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let mut n = temp[0];
    let m = temp[1];
    let p = temp[2]-1;
    let q = temp[3]-1;

    let mut result = 0usize;
    while n > 0 {
        if p <= result % 12 && result % 12 <= p+q {
            n -= (m*2).min(n);
        } else {
            n -= m.min(n);
        }
        result += 1;
    }
    println!("{}", result);
}
0