結果

問題 No.1299 Random Array Score
ユーザー tentententen
提出日時 2022-08-04 18:03:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 1,361 bytes
コンパイル時間 3,811 ms
コンパイル使用メモリ 74,520 KB
実行使用メモリ 62,804 KB
最終ジャッジ日時 2023-10-12 15:57:59
合計ジャッジ時間 13,984 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,408 KB
testcase_01 AC 43 ms
49,460 KB
testcase_02 AC 43 ms
49,500 KB
testcase_03 AC 243 ms
59,880 KB
testcase_04 AC 230 ms
59,816 KB
testcase_05 AC 227 ms
57,700 KB
testcase_06 AC 215 ms
57,704 KB
testcase_07 AC 227 ms
57,416 KB
testcase_08 AC 243 ms
60,792 KB
testcase_09 AC 94 ms
52,432 KB
testcase_10 AC 195 ms
55,592 KB
testcase_11 AC 125 ms
54,580 KB
testcase_12 AC 223 ms
57,544 KB
testcase_13 AC 236 ms
60,864 KB
testcase_14 AC 215 ms
57,488 KB
testcase_15 AC 213 ms
57,952 KB
testcase_16 AC 225 ms
57,764 KB
testcase_17 AC 129 ms
55,124 KB
testcase_18 AC 211 ms
53,908 KB
testcase_19 AC 209 ms
55,656 KB
testcase_20 AC 185 ms
55,608 KB
testcase_21 AC 82 ms
52,708 KB
testcase_22 AC 141 ms
55,744 KB
testcase_23 AC 222 ms
57,348 KB
testcase_24 AC 228 ms
57,672 KB
testcase_25 AC 219 ms
57,972 KB
testcase_26 AC 86 ms
52,208 KB
testcase_27 AC 142 ms
54,608 KB
testcase_28 AC 126 ms
54,980 KB
testcase_29 AC 157 ms
55,224 KB
testcase_30 AC 217 ms
57,552 KB
testcase_31 AC 160 ms
55,676 KB
testcase_32 AC 243 ms
60,288 KB
testcase_33 AC 250 ms
62,568 KB
testcase_34 AC 198 ms
56,244 KB
testcase_35 AC 249 ms
62,804 KB
testcase_36 AC 194 ms
56,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    static final int MOD = 998244353;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        long k = sc.nextLong();
        long total = 0;
        for (int i = 0; i < n; i++) {
            total += sc.nextInt();
        }
        System.out.println(total % MOD * 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;
        }
    }
}

class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0