結果
| 問題 | No.2111 Sum of Diff | 
| コンテスト | |
| ユーザー |  paruf4 | 
| 提出日時 | 2022-10-28 23:59:33 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 250 ms / 2,000 ms | 
| コード長 | 189 bytes | 
| コンパイル時間 | 205 ms | 
| コンパイル使用メモリ | 82,500 KB | 
| 実行使用メモリ | 107,520 KB | 
| 最終ジャッジ日時 | 2024-07-06 03:17:58 | 
| 合計ジャッジ時間 | 4,213 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 20 | 
ソースコード
n = int(input())
a = list(map(int, input().split()))
mod = 998244353
res = 0
for i in range(n):
    res += a[i]*(pow(2, n-1-i, mod)-1)
    res -= a[i]*(pow(2, i, mod)-1)
print(res % mod)
            
            
            
        