結果

問題 No.2111 Sum of Diff
ユーザー ニックネームニックネーム
提出日時 2022-10-28 21:44:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 875 ms / 2,000 ms
コード長 211 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 24,028 KB
最終ジャッジ日時 2023-09-20 04:36:41
合計ジャッジ時間 11,264 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,740 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 AC 863 ms
24,000 KB
testcase_03 AC 576 ms
18,848 KB
testcase_04 AC 114 ms
10,176 KB
testcase_05 AC 872 ms
23,892 KB
testcase_06 AC 862 ms
23,820 KB
testcase_07 AC 201 ms
11,932 KB
testcase_08 AC 277 ms
13,348 KB
testcase_09 AC 58 ms
9,100 KB
testcase_10 AC 77 ms
9,412 KB
testcase_11 AC 401 ms
15,816 KB
testcase_12 AC 384 ms
15,480 KB
testcase_13 AC 248 ms
12,724 KB
testcase_14 AC 704 ms
21,172 KB
testcase_15 AC 831 ms
23,356 KB
testcase_16 AC 347 ms
14,668 KB
testcase_17 AC 875 ms
23,864 KB
testcase_18 AC 252 ms
12,812 KB
testcase_19 AC 644 ms
20,048 KB
testcase_20 AC 864 ms
24,028 KB
testcase_21 AC 25 ms
8,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input()); mod = 998244353; ans = 0
for i, v in enumerate(map(int, input().split())):
    if i < n-1: ans = (ans+v*(pow(2, n-i-1, mod)-1))%mod
    if i > 0: ans = (ans-v*(pow(2, i, mod)-1))%mod
print(ans)
0