結果

問題 No.2111 Sum of Diff
ユーザー paruf4
提出日時 2022-10-28 23:52:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 239 bytes
コンパイル時間 1,285 ms
コンパイル使用メモリ 81,688 KB
実行使用メモリ 108,548 KB
最終ジャッジ日時 2024-07-06 03:12:21
合計ジャッジ時間 4,111 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for i in range(n-1):
    res += (a[i]-a[-1+i])*s[-1+i]
    res %= mod
print(res)

0