結果

問題 No.970 数列変換マシン
ユーザー phsplsphspls
提出日時 2020-01-19 11:12:35
言語 Rust
(1.77.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 656 bytes
コンパイル時間 5,133 ms
コンパイル使用メモリ 149,584 KB
実行使用メモリ 9,636 KB
最終ジャッジ日時 2023-09-15 19:55:21
合計ジャッジ時間 2,501 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
9,432 KB
testcase_01 AC 19 ms
9,636 KB
testcase_02 AC 20 ms
9,420 KB
testcase_03 AC 17 ms
9,160 KB
testcase_04 AC 15 ms
9,112 KB
testcase_05 AC 17 ms
9,628 KB
testcase_06 AC 14 ms
8,608 KB
testcase_07 AC 16 ms
9,180 KB
testcase_08 AC 16 ms
9,128 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Read;

fn solve(n: isize, y: Vec<isize>) {
    let summary: isize = y.iter().sum();
    let result = y.iter().map(|i| (summary - (n - 1) * i).to_string()).collect::<Vec<String>>().join(" ");
    println!("{}", result);
}

fn main() {
    let mut all_data = String::new();
    std::io::stdin().read_to_string(&mut all_data).ok();
    let all_data: Vec<&str> = all_data.trim().split('\n').map(|l| l.trim()).collect();
    let n: isize = all_data.iter().next().unwrap().parse::<isize>().unwrap();
    let y: Vec<isize> = all_data.iter().skip(1).next().unwrap().split_whitespace().map(|l| l.parse::<isize>().unwrap()).collect();
    solve(n, y);
}
0