結果

問題 No.2451 Redistribute Integers
ユーザー あさくち
提出日時 2023-09-01 21:27:30
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 927 bytes
コンパイル時間 11,109 ms
コンパイル使用メモリ 379,924 KB
実行使用メモリ 13,184 KB
最終ジャッジ日時 2024-06-11 10:59:13
合計ジャッジ時間 12,515 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let n = input_value();
    let a: Vec<isize> = input_vec();

    let mut total = 0;

    for i in 0..n {
        total += a[i];
    }

    if total % n as isize == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn input_value<T>() -> T
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let stdin = std::io::stdin();

    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf = buf.trim_end().to_owned();

    let n = buf.parse().unwrap();

    n
}

fn input_vec<T>() -> Vec<T>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let stdin = std::io::stdin();

    let mut buf = String::new();
    stdin.read_line(&mut buf).unwrap();
    buf = buf.trim_end().to_owned();

    let iter = buf.split_whitespace();

    let line = iter.map(|x| x.parse().unwrap()).collect();

    line
}
0