結果

問題 No.1299 Random Array Score
ユーザー tentententen
提出日時 2024-02-07 09:08:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 1,549 bytes
コンパイル時間 8,507 ms
コンパイル使用メモリ 79,692 KB
実行使用メモリ 67,492 KB
最終ジャッジ日時 2024-02-07 09:09:06
合計ジャッジ時間 18,697 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
54,880 KB
testcase_01 AC 67 ms
54,760 KB
testcase_02 AC 70 ms
54,896 KB
testcase_03 AC 283 ms
65,104 KB
testcase_04 AC 279 ms
65,372 KB
testcase_05 AC 260 ms
62,088 KB
testcase_06 AC 254 ms
61,992 KB
testcase_07 AC 260 ms
61,984 KB
testcase_08 AC 284 ms
65,056 KB
testcase_09 AC 112 ms
56,152 KB
testcase_10 AC 234 ms
60,248 KB
testcase_11 AC 156 ms
58,864 KB
testcase_12 AC 253 ms
61,876 KB
testcase_13 AC 284 ms
65,212 KB
testcase_14 AC 257 ms
62,072 KB
testcase_15 AC 255 ms
62,012 KB
testcase_16 AC 257 ms
62,012 KB
testcase_17 AC 159 ms
58,544 KB
testcase_18 AC 227 ms
59,792 KB
testcase_19 AC 237 ms
59,896 KB
testcase_20 AC 210 ms
60,012 KB
testcase_21 AC 99 ms
56,172 KB
testcase_22 AC 178 ms
59,492 KB
testcase_23 AC 252 ms
62,008 KB
testcase_24 AC 256 ms
62,016 KB
testcase_25 AC 256 ms
61,968 KB
testcase_26 AC 107 ms
56,160 KB
testcase_27 AC 192 ms
59,484 KB
testcase_28 AC 167 ms
59,280 KB
testcase_29 AC 206 ms
60,116 KB
testcase_30 AC 254 ms
62,020 KB
testcase_31 AC 207 ms
60,208 KB
testcase_32 AC 283 ms
65,184 KB
testcase_33 AC 294 ms
67,492 KB
testcase_34 AC 236 ms
60,472 KB
testcase_35 AC 283 ms
67,248 KB
testcase_36 AC 236 ms
60,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

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 sum = IntStream.range(0, n).mapToLong(i -> sc.nextInt()).sum() % MOD;
        System.out.println(pow(2, k) * sum % 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;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0