結果

問題 No.9001 標準入出力の練習問題(テスト用)
ユーザー dyun
提出日時 2017-12-28 10:40:44
言語 Rust
(1.94.0 + proconio + num + itertools)
コンパイル:
/usr/bin/rustc_custom
実行:
./target/release/main
結果
AC  
実行時間 0 ms / 1,000 ms
コード長 556 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 13,254 ms
コンパイル使用メモリ 187,572 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-28 01:36:01
合計ジャッジ時間 13,151 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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]);
}
0