結果

問題 No.988 N×Mマス計算(総和)
ユーザー kokatsukokatsu
提出日時 2022-02-26 20:50:44
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 3,921 ms
コンパイル使用メモリ 204,372 KB
実行使用メモリ 9,256 KB
最終ジャッジ日時 2023-09-04 16:11:42
合計ジャッジ時間 4,259 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 21 ms
4,376 KB
testcase_11 AC 22 ms
8,144 KB
testcase_12 AC 47 ms
8,104 KB
testcase_13 AC 21 ms
5,952 KB
testcase_14 AC 18 ms
5,860 KB
testcase_15 AC 25 ms
4,376 KB
testcase_16 AC 43 ms
5,960 KB
testcase_17 AC 51 ms
6,644 KB
testcase_18 AC 23 ms
8,252 KB
testcase_19 AC 44 ms
6,960 KB
testcase_20 AC 70 ms
9,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    long N, M, K;
    readf("%d %d %d\n", N, M, K);

    auto input = readln.chomp.split;
    string op = input[0];
    auto B = input[1..$].to!(long[]);

    long Asum;
    foreach (_; 0 .. N) {
        long A;
        readf("%d\n", A);

        Asum = (Asum + A) % K;
    }

    long res;
    foreach (b; B) {
        if (op == "+") res = (res + Asum + (b * N) % K) % K;
        else res = (res + (Asum * b) % K) % K;
    }

    res.writeln;
}
0