結果

問題 No.1299 Random Array Score
ユーザー tentententen
提出日時 2020-12-01 07:42:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 837 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 4,366 ms
コンパイル使用メモリ 70,988 KB
実行使用メモリ 65,280 KB
最終ジャッジ日時 2023-10-11 03:20:57
合計ジャッジ時間 25,615 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
56,100 KB
testcase_01 AC 124 ms
55,540 KB
testcase_02 AC 124 ms
55,808 KB
testcase_03 AC 775 ms
64,444 KB
testcase_04 AC 762 ms
64,504 KB
testcase_05 AC 685 ms
63,768 KB
testcase_06 AC 659 ms
62,296 KB
testcase_07 AC 660 ms
62,644 KB
testcase_08 AC 736 ms
64,492 KB
testcase_09 AC 234 ms
59,324 KB
testcase_10 AC 519 ms
60,600 KB
testcase_11 AC 337 ms
60,712 KB
testcase_12 AC 677 ms
61,252 KB
testcase_13 AC 739 ms
64,432 KB
testcase_14 AC 642 ms
61,852 KB
testcase_15 AC 677 ms
62,168 KB
testcase_16 AC 653 ms
62,584 KB
testcase_17 AC 359 ms
60,440 KB
testcase_18 AC 542 ms
60,196 KB
testcase_19 AC 568 ms
60,780 KB
testcase_20 AC 490 ms
61,072 KB
testcase_21 AC 217 ms
58,724 KB
testcase_22 AC 375 ms
60,804 KB
testcase_23 AC 657 ms
62,284 KB
testcase_24 AC 709 ms
62,752 KB
testcase_25 AC 672 ms
61,740 KB
testcase_26 AC 208 ms
60,444 KB
testcase_27 AC 401 ms
60,452 KB
testcase_28 AC 366 ms
60,396 KB
testcase_29 AC 434 ms
60,668 KB
testcase_30 AC 656 ms
61,848 KB
testcase_31 AC 440 ms
60,352 KB
testcase_32 AC 793 ms
65,232 KB
testcase_33 AC 824 ms
65,280 KB
testcase_34 AC 629 ms
64,912 KB
testcase_35 AC 837 ms
64,724 KB
testcase_36 AC 628 ms
64,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    static final int MOD = 998244353;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        long total = 0;
        for (int i = 0; i < n; i++) {
            total += sc.nextInt();
        }
        total %= MOD;
        System.out.println(total * pow(2, k) % MOD);
    }
    
    static long pow(long x, long p) {
        if (p == 0) {
            return 1;
        } else if (p % 2 == 0) {
            return pow(x * x % MOD, p / 2);
        } else {
            return pow(x, p - 1) * x % MOD;
        }
    }
}
0