結果
| 問題 | No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用) |
| ユーザー |
|
| 提出日時 | 2019-04-23 10:35:29 |
| 言語 | Rust (1.94.0 + proconio + num + itertools) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 522 bytes |
| 記録 | |
| コンパイル時間 | 10,647 ms |
| コンパイル使用メモリ | 191,704 KB |
| 実行使用メモリ | 7,168 KB |
| 最終ジャッジ日時 | 2026-04-30 15:29:57 |
| 合計ジャッジ時間 | 4,423 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
コンパイルメッセージ
warning: unused variable: `num` --> src/main.rs:17:9 | 17 | let num: i32 = read(); | ^^^ help: if this is intentional, prefix it with an underscore: `_num` | = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
ソースコード
fn read<T: std::str::FromStr>() -> T {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim()
.split_whitespace()
.map(|e| e.parse().ok().unwrap())
.collect()
}
fn main() {
let num: i32 = read();
let numbers: Vec<i64> = read_vec();
print!("{}", numbers.iter().fold(0, |sum, i| sum + i));
}