結果

問題 No.987 N×Mマス計算(基本)
ユーザー cra77756176
提出日時 2022-12-15 22:40:23
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 729 bytes
コンパイル時間 13,667 ms
コンパイル使用メモリ 398,656 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-14 14:07:28
合計ジャッジ時間 15,102 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut xx = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
    let xx: Vec<&str> = xx.split_whitespace().collect();

    let m: usize = xx[1].parse().unwrap();
    let bb: Vec<u64> = xx[3..3 + m].iter().map(|&s| s.parse().unwrap()).collect();
    let aa: Vec<u64> = xx[3 + m..].iter().map(|&s| s.parse().unwrap()).collect();

    let op = match xx.get(2) {
        Some(&"+") => |a, b| a + b,
        Some(&"*") => |a, b| a * b,
        _ => unreachable!(),
    };

    for a in aa {
        for (i, &b) in bb.iter().enumerate() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", op(a, b));
        }
        println!();
    }
}
0