結果

問題 No.2111 Sum of Diff
ユーザー sepa38sepa38
提出日時 2022-12-13 15:42:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 197 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 107,264 KB
最終ジャッジ日時 2024-04-25 01:23:06
合計ジャッジ時間 5,314 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
51,840 KB
testcase_01 AC 37 ms
51,712 KB
testcase_02 AC 267 ms
101,888 KB
testcase_03 AC 177 ms
93,312 KB
testcase_04 AC 67 ms
66,048 KB
testcase_05 AC 246 ms
102,016 KB
testcase_06 AC 245 ms
101,888 KB
testcase_07 AC 85 ms
71,296 KB
testcase_08 AC 106 ms
76,032 KB
testcase_09 AC 53 ms
62,592 KB
testcase_10 AC 56 ms
63,744 KB
testcase_11 AC 135 ms
83,456 KB
testcase_12 AC 130 ms
83,072 KB
testcase_13 AC 98 ms
74,240 KB
testcase_14 AC 203 ms
98,816 KB
testcase_15 AC 237 ms
107,264 KB
testcase_16 AC 121 ms
80,128 KB
testcase_17 AC 248 ms
101,760 KB
testcase_18 AC 99 ms
74,624 KB
testcase_19 AC 190 ms
97,408 KB
testcase_20 AC 251 ms
101,888 KB
testcase_21 AC 47 ms
60,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
mod = 998244353
ans = 0
for i in range(n):
  ans -= a[i] * (pow(2, i, mod) - 1)
  ans += a[i] * (pow(2, n-i-1, mod) - 1)
  ans %= mod
print(ans)
0