結果

問題 No.9001 標準入出力の練習問題(テスト用)
ユーザー yuzu32utyuzu32ut
提出日時 2022-02-27 15:00:32
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 1,050 bytes
コンパイル時間 3,834 ms
コンパイル使用メモリ 138,844 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-19 01:47:17
合計ジャッジ時間 3,818 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

pub mod ut {
    #[inline]
    pub fn read_string() -> String {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim().to_string()
    }

    #[inline]
    pub fn read_single<T>() -> T
    where
        T: std::str::FromStr,
        <T as std::str::FromStr>::Err: std::fmt::Debug,
    {
        let buf = read_string();
        buf.parse().unwrap()
    }

    #[inline]
    pub fn read_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
        <T as std::str::FromStr>::Err: std::fmt::Debug,
    {
        read_string()
            .split_ascii_whitespace()
            .map(|e| e.parse().unwrap())
            .collect()
    }

    #[inline]
    pub fn read_two_values<T>() -> (T, T)
    where
        T: std::str::FromStr + Copy,
        <T as std::str::FromStr>::Err: std::fmt::Debug,
    {
        let v = read_vector();
        (v[0], v[1])
    }
}

fn main() {
    let (a, b) = ut::read_two_values::<usize>();
    let s = ut::read_string();
    println!("{} {}", a + b, s);
}
0