結果
問題 | No.970 数列変換マシン |
ユーザー |
![]() |
提出日時 | 2020-01-17 22:14:29 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 548 bytes |
コンパイル時間 | 21,409 ms |
コンパイル使用メモリ | 383,304 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 20:49:05 |
合計ジャッジ時間 | 20,872 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
use std::io::Read; fn run() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let n: i64 = it.next().unwrap().parse().unwrap(); let y: Vec<i64> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect(); let sum = y.iter().fold(0, |s, a| s + *a); let mut out = String::new(); for y in y { let x = sum - (n - 1) * y; out.push_str(&format!("{} ", x)); } out.pop(); println!("{}", out); } fn main() { run(); }