結果

問題 No.2111 Sum of Diff
ユーザー 👑 rin204rin204
提出日時 2022-10-28 21:36:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 267 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 114,136 KB
最終ジャッジ日時 2023-09-20 04:24:21
合計ジャッジ時間 4,168 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,232 KB
testcase_01 AC 74 ms
71,252 KB
testcase_02 AC 147 ms
113,928 KB
testcase_03 AC 122 ms
108,220 KB
testcase_04 AC 87 ms
79,884 KB
testcase_05 AC 146 ms
114,136 KB
testcase_06 AC 146 ms
113,964 KB
testcase_07 AC 95 ms
85,264 KB
testcase_08 AC 98 ms
90,260 KB
testcase_09 AC 84 ms
76,492 KB
testcase_10 AC 85 ms
77,740 KB
testcase_11 AC 109 ms
97,684 KB
testcase_12 AC 106 ms
96,572 KB
testcase_13 AC 95 ms
88,436 KB
testcase_14 AC 126 ms
102,020 KB
testcase_15 AC 145 ms
113,768 KB
testcase_16 AC 102 ms
93,864 KB
testcase_17 AC 143 ms
113,832 KB
testcase_18 AC 96 ms
88,528 KB
testcase_19 AC 124 ms
101,680 KB
testcase_20 AC 143 ms
113,968 KB
testcase_21 AC 80 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

n = int(input())
A = list(map(int, input().split()))

pow2 = [1]
for _ in range(n):
    pow2.append(pow2[-1] * 2 % MOD)

ans = 0
for i in range(n):
    ans += pow2[n - 1 - i] * A[i] % MOD
    ans -= pow2[i] * A[i] % MOD
    ans %= MOD
    
print(ans)
0