結果

問題 No.2111 Sum of Diff
ユーザー shirokumashirokuma
提出日時 2022-10-30 03:02:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 295 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 102,180 KB
最終ジャッジ日時 2023-09-21 03:50:37
合計ジャッジ時間 5,985 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,160 KB
testcase_01 AC 74 ms
70,892 KB
testcase_02 AC 295 ms
100,188 KB
testcase_03 AC 214 ms
98,508 KB
testcase_04 AC 103 ms
78,636 KB
testcase_05 AC 291 ms
100,348 KB
testcase_06 AC 291 ms
100,616 KB
testcase_07 AC 121 ms
82,448 KB
testcase_08 AC 140 ms
85,908 KB
testcase_09 AC 87 ms
76,688 KB
testcase_10 AC 92 ms
77,476 KB
testcase_11 AC 171 ms
91,228 KB
testcase_12 AC 168 ms
91,208 KB
testcase_13 AC 135 ms
84,940 KB
testcase_14 AC 244 ms
102,180 KB
testcase_15 AC 283 ms
100,004 KB
testcase_16 AC 157 ms
89,132 KB
testcase_17 AC 291 ms
100,516 KB
testcase_18 AC 138 ms
84,972 KB
testcase_19 AC 231 ms
101,488 KB
testcase_20 AC 292 ms
100,224 KB
testcase_21 AC 82 ms
76,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki2110
mod = 998244353
N = int(input())
A = list(map(int, input().split()))
ans = A[0] * (pow(2,N-1,mod) - 1) - A[-1] * (pow(2,N-1,mod) - 1)
if N >= 3:
    for i in range(1,N-1):
        ans += A[i]*(pow(2,N-i-1,mod) - pow(2,i,mod))
        ans %= mod

print(ans%mod)
0