結果

問題 No.2111 Sum of Diff
ユーザー ああいい
提出日時 2022-10-31 10:51:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 320 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 107,008 KB
最終ジャッジ日時 2024-07-08 01:02:10
合計ジャッジ時間 5,820 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

P = 998244353
ans = 0
sub = a[0]
for i in range(1,N):
    tmp = a[i] * (pow(2,i,P)-1) % P
    ans += pow(2,N - i - 1,P) * (tmp - sub) % P
    sub += a[i] * pow(2,i,P)
    sub %= P
    ans %= P
    #print(ans,sub)
print((-ans)%P)
0