結果

問題 No.1406 Test
ユーザー akakimidori
提出日時 2021-02-20 02:07:32
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 14,122 ms
コンパイル使用メモリ 378,380 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-17 05:18:55
合計ジャッジ時間 13,910 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

fn read() -> (usize, Vec<usize>) {
    let mut s = String::new();
    use std::io::*;
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    (n, it.flat_map(|s| s.parse()).collect())
}

fn main() {
    let (n, a) = read();
    assert!(1 <= n && n <= 10);
    assert!(a.len() == n - 1 && a.iter().all(|a| *a <= 100));
    let mut ans = 0;
    for i in 0..=100 {
        let sum = a.iter().sum::<usize>() + i;
        if sum % n == 0 {
            ans += 1;
        }
    }
    println!("{}", ans);
}
0