結果
| 問題 | No.1299 Random Array Score |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-12-01 07:42:31 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 474 ms / 2,000 ms |
| コード長 | 661 bytes |
| 記録 | |
| コンパイル時間 | 1,670 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 59,384 KB |
| 最終ジャッジ日時 | 2026-04-04 02:56:10 |
| 合計ジャッジ時間 | 14,747 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
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;
}
}
}
tenten