結果

問題 No.9001 標準入出力の練習問題(テスト用)
ユーザー YoshihitoYoshihito
提出日時 2019-11-15 17:50:07
言語 Rust
(1.77.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 704 bytes
コンパイル時間 1,283 ms
コンパイル使用メモリ 177,076 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 03:41:00
合計ジャッジ時間 1,753 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

use std::io;
use std::io::{Stdin, BufRead};

struct Input {
    a: i32,
    b: i32,
    s: String,
}

fn main() {
    let mut stdin = io::stdin();
    let input = read_input(&mut stdin);
    solve(input);
}

fn read_input(stdin: &mut Stdin) -> Input {
    let mut lock = stdin.lock();

    let mut s = String::new();
    lock.read_line(&mut s).expect("can't read 1st line.");
    let tokens: Vec<i32> = s.trim_end().split(" ").map(|s| s.parse().expect("can't parse")).collect();

    s.clear();
    lock.read_line(&mut s).expect("can't read 1st line.");
    Input { a: tokens[0], b: tokens[1], s: s.trim_end().to_string() }
}

fn solve(input: Input) {
    println!("{} {}", input.a + input.b, input.s);
}
0