結果

問題 No.2111 Sum of Diff
ユーザー lloyzlloyz
提出日時 2022-10-28 21:48:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 321 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 637 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 102,188 KB
最終ジャッジ日時 2023-09-20 04:40:59
合計ジャッジ時間 6,264 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,284 KB
testcase_01 AC 78 ms
71,160 KB
testcase_02 AC 321 ms
100,688 KB
testcase_03 AC 225 ms
98,968 KB
testcase_04 AC 108 ms
78,980 KB
testcase_05 AC 302 ms
100,404 KB
testcase_06 AC 303 ms
100,412 KB
testcase_07 AC 129 ms
82,612 KB
testcase_08 AC 150 ms
86,384 KB
testcase_09 AC 92 ms
76,576 KB
testcase_10 AC 98 ms
77,512 KB
testcase_11 AC 180 ms
91,536 KB
testcase_12 AC 175 ms
91,360 KB
testcase_13 AC 141 ms
84,960 KB
testcase_14 AC 254 ms
101,668 KB
testcase_15 AC 294 ms
100,316 KB
testcase_16 AC 166 ms
89,532 KB
testcase_17 AC 303 ms
100,340 KB
testcase_18 AC 143 ms
84,844 KB
testcase_19 AC 244 ms
102,188 KB
testcase_20 AC 304 ms
100,408 KB
testcase_21 AC 89 ms
76,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
mod = 998244353

ans = 0
for i in range(n):
    if i < n - 1:
        ans += A[i] * (pow(2, n - i - 1, mod) - 1) % mod
        ans %= mod
    if i > 0:
        ans -= A[i] * (pow(2, i, mod) - 1) % mod
        ans %= mod
print(ans)
0