結果

問題 No.988 N×Mマス計算(総和)
ユーザー gemmarogemmaro
提出日時 2020-02-14 22:05:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 666 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 74,620 KB
実行使用メモリ 7,980 KB
最終ジャッジ日時 2023-09-20 11:58:18
合計ジャッジ時間 4,396 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 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 #

#include <iostream>
#include <string>
#include <vector>

int main() {
    uint32_t N, M, K;
    std::cin >> N >> M >> K;

    std::string op;
    std::cin >> op;

    std::vector<uint32_t> bs{};
    for (uint32_t i = 0; i < M; ++i) {
        uint32_t b;
        std::cin >> b;
        bs.push_back(b);
    }

    std::vector<uint32_t> as{};
    for (uint32_t i = 0; i < N; ++i) {
        uint32_t a;
        std::cin >> a;
        as.push_back(a);
    }

    uint32_t result = 0;
    for (auto a : as) {
        for (auto b : bs) {
            result += op == "+" ? a + b : a * b;
            result %= K;
        }
    }

    std::cout << result % K << std::endl;
}
0