結果
| 問題 |
No.9001 標準入出力の練習問題(テスト用)
|
| ユーザー |
|
| 提出日時 | 2017-12-28 10:40:44 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 556 bytes |
| コンパイル時間 | 15,604 ms |
| コンパイル使用メモリ | 379,548 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-21 08:39:11 |
| 合計ジャッジ時間 | 12,592 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 |
ソースコード
use std::io::{stdin, BufRead};
use std::str::FromStr;
fn read_lines() -> Vec<String> {
let stdin = stdin();
let lines = stdin.lock().lines().map(|l| l.unwrap()).collect();
lines
}
fn to_nums<T>(line: &str) -> Vec<T>
where
T: FromStr,
<T as FromStr>::Err: std::fmt::Debug,
{
line.split_whitespace()
.map(|n| n.parse::<T>().unwrap())
.collect()
}
fn main() {
let lines = read_lines();
let nums = to_nums::<isize>(&lines[0]);
let ans = nums.iter().sum::<isize>();
println!("{} {}", ans, &lines[1]);
}