結果

問題 No.740 幻の木
ユーザー phsplsphspls
提出日時 2022-12-04 17:09:44
言語 Rust
(1.77.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 160,552 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 01:07:22
合計ジャッジ時間 1,100 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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