結果

問題 No.2111 Sum of Diff
ユーザー qibqib
提出日時 2022-11-12 20:21:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 103,144 KB
最終ジャッジ日時 2023-10-12 10:31:00
合計ジャッジ時間 6,001 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,436 KB
testcase_01 AC 70 ms
71,280 KB
testcase_02 AC 135 ms
101,840 KB
testcase_03 AC 109 ms
99,600 KB
testcase_04 AC 84 ms
78,712 KB
testcase_05 AC 132 ms
101,824 KB
testcase_06 AC 132 ms
101,976 KB
testcase_07 AC 87 ms
82,840 KB
testcase_08 AC 92 ms
86,532 KB
testcase_09 AC 80 ms
76,308 KB
testcase_10 AC 82 ms
77,440 KB
testcase_11 AC 100 ms
91,752 KB
testcase_12 AC 98 ms
91,684 KB
testcase_13 AC 92 ms
85,084 KB
testcase_14 AC 117 ms
103,144 KB
testcase_15 AC 132 ms
101,292 KB
testcase_16 AC 97 ms
89,612 KB
testcase_17 AC 133 ms
101,536 KB
testcase_18 AC 92 ms
85,044 KB
testcase_19 AC 117 ms
103,136 KB
testcase_20 AC 134 ms
101,532 KB
testcase_21 AC 80 ms
76,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())
a = list(map(int, input().split()))

pow2 = [1 for _ in range(n)]
for i in range(1, n):
  pow2[i] = (pow2[i - 1] * 2) % MOD

ans = 0
for i in range(n):
  ans = (ans + a[i] * (pow2[n - 1 - i] - pow2[i])) % MOD

print(ans)
0