結果

問題 No.988 N×Mマス計算(総和)
ユーザー phsplsphspls
提出日時 2020-02-14 21:39:05
言語 Rust
(1.77.0)
結果
TLE  
実行時間 -
コード長 937 bytes
コンパイル時間 866 ms
コンパイル使用メモリ 147,808 KB
実行使用メモリ 12,372 KB
最終ジャッジ日時 2023-09-20 11:38:51
合計ジャッジ時間 5,838 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

use std::io::Read;

fn main() {
    let mut all_data = String::new();
    std::io::stdin().read_to_string(&mut all_data).ok();
    let mut all_data = all_data.trim().split('\n').map(|s| s.trim());
    let nmk: Vec<u128> = all_data.next().unwrap().split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n: u128 = nmk[0];
    let k: u128 = nmk[2];
    let opb: Vec<&str> = all_data.next().unwrap().split_whitespace().collect();
    let b: Vec<u128> = opb.iter().skip(1).map(|s| s.parse().unwrap()).collect();
    let op: &str = opb[0];
    let a: Vec<u128> = all_data.take(n as usize).map(|s| s.parse().unwrap()).collect();
    let mut result: u128 = 0;
    for i in a.iter() {
        result += b.iter()
            .map(|j| match op {
                "+" => i + j,
                "*" => i * j,
                _ => 0
            })
            .sum::<u128>()
        ;
        result %= k;
    }
    println!("{}", result);
}
0