結果

問題 No.1299 Random Array Score
ユーザー ks2mks2m
提出日時 2020-11-27 22:08:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 310 ms / 2,000 ms
コード長 850 bytes
コンパイル時間 4,678 ms
コンパイル使用メモリ 73,768 KB
実行使用メモリ 69,224 KB
最終ジャッジ日時 2023-10-01 06:11:19
合計ジャッジ時間 14,386 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,692 KB
testcase_01 AC 43 ms
49,452 KB
testcase_02 AC 44 ms
49,224 KB
testcase_03 AC 284 ms
68,964 KB
testcase_04 AC 279 ms
69,104 KB
testcase_05 AC 254 ms
64,444 KB
testcase_06 AC 243 ms
64,504 KB
testcase_07 AC 310 ms
65,584 KB
testcase_08 AC 278 ms
69,224 KB
testcase_09 AC 87 ms
52,272 KB
testcase_10 AC 199 ms
58,552 KB
testcase_11 AC 114 ms
54,544 KB
testcase_12 AC 303 ms
65,592 KB
testcase_13 AC 284 ms
69,084 KB
testcase_14 AC 242 ms
65,036 KB
testcase_15 AC 299 ms
65,128 KB
testcase_16 AC 295 ms
64,064 KB
testcase_17 AC 130 ms
56,604 KB
testcase_18 AC 208 ms
58,876 KB
testcase_19 AC 217 ms
60,540 KB
testcase_20 AC 155 ms
57,084 KB
testcase_21 AC 81 ms
51,784 KB
testcase_22 AC 137 ms
54,596 KB
testcase_23 AC 258 ms
63,944 KB
testcase_24 AC 249 ms
64,172 KB
testcase_25 AC 247 ms
64,376 KB
testcase_26 AC 71 ms
51,864 KB
testcase_27 AC 125 ms
56,968 KB
testcase_28 AC 125 ms
55,032 KB
testcase_29 AC 153 ms
57,072 KB
testcase_30 AC 249 ms
65,540 KB
testcase_31 AC 150 ms
57,088 KB
testcase_32 AC 281 ms
68,812 KB
testcase_33 AC 281 ms
68,820 KB
testcase_34 AC 218 ms
67,440 KB
testcase_35 AC 284 ms
68,992 KB
testcase_36 AC 222 ms
67,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long k = Long.parseLong(sa[1]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int mod = 998244353;
		long ans = 0;
		for (int i = 0; i < n; i++) {
			ans += a[i];
		}
		ans %= mod;
		ans *= power(2, k, mod);
		ans %= mod;
		System.out.println(ans);
	}

	static long power(long x, long n, int m) {
		if (n == 0) {
			return 1;
		}
		long val = power(x, n / 2, m);
		val = val * val % m;
		if (n % 2 == 1) {
			val = val * x % m;
		}
		return val;
	}
}
0