結果

問題 No.1219 Mancala Combo
ユーザー phspls
提出日時 2022-11-11 00:48:37
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 13,513 ms
コンパイル使用メモリ 395,976 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 01:25:25
合計ジャッジ時間 14,295 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut a = String::new();
    std::io::stdin().read_line(&mut a).ok();
    let a: Vec<usize> = a.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();

    let mut addval = 0usize;
    for i in (0..n).rev() {
        if (a[i]+addval) % (i+1) > 0 {
            println!("No");
            return;
        }
        addval += (a[i]+addval) / (i+1);
    }
    println!("Yes");
}
0