結果

問題 No.1343 Dividing Digit
ユーザー kokatsukokatsu
提出日時 2021-12-31 11:17:08
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 2,990 ms
コンパイル使用メモリ 204,948 KB
実行使用メモリ 8,532 KB
最終ジャッジ日時 2023-09-04 15:37:13
合計ジャッジ時間 4,979 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 17 ms
7,792 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 6 ms
4,404 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 7 ms
4,660 KB
testcase_08 AC 14 ms
7,756 KB
testcase_09 AC 15 ms
6,720 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 AC 13 ms
7,572 KB
testcase_13 AC 12 ms
5,908 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 6 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 AC 15 ms
7,272 KB
testcase_18 AC 16 ms
8,532 KB
testcase_19 AC 12 ms
7,460 KB
testcase_20 AC 8 ms
4,792 KB
testcase_21 AC 14 ms
6,704 KB
testcase_22 AC 15 ms
6,996 KB
testcase_23 AC 18 ms
8,136 KB
testcase_24 AC 13 ms
7,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

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

    auto A = readln.chomp.split.to!(long[]);

    long M = A.sum;

    long res, num = 1;
    foreach_reverse (a; A) {
        res = (res + a * num) % M;
        num = (num * K) % M;
    }

    res.writeln;
}
0