結果

問題 No.988 N×Mマス計算(総和)
ユーザー cra77756176cra77756176
提出日時 2022-12-17 13:27:13
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 732 bytes
コンパイル時間 13,706 ms
コンパイル使用メモリ 377,784 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-28 08:11:30
合計ジャッジ時間 17,805 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,660 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 0 ms
5,376 KB
testcase_07 AC 0 ms
5,376 KB
testcase_08 AC 0 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

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 k: u64 = xx[2].parse().unwrap();
    let bb: Vec<u64> = xx[4..4 + m].iter().map(|&s| s.parse().unwrap()).collect();
    let aa: Vec<u64> = xx[4 + m..].iter().map(|&s| s.parse().unwrap()).collect();

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

    let mut answer = 0;
    for a in &aa {
        for b in &bb {
            answer += op(a, b);
            answer %= k;
        }
    }

    println!("{answer}");
}
0