結果

問題 No.2111 Sum of Diff
ユーザー SI1000-githubSI1000-github
提出日時 2022-10-29 14:50:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 504 ms / 2,000 ms
コード長 734 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 101,344 KB
最終ジャッジ日時 2023-09-20 18:38:55
合計ジャッジ時間 8,033 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,192 KB
testcase_01 AC 79 ms
71,348 KB
testcase_02 AC 504 ms
100,468 KB
testcase_03 AC 358 ms
99,140 KB
testcase_04 AC 129 ms
79,268 KB
testcase_05 AC 497 ms
100,424 KB
testcase_06 AC 495 ms
100,652 KB
testcase_07 AC 171 ms
83,120 KB
testcase_08 AC 207 ms
86,552 KB
testcase_09 AC 100 ms
76,464 KB
testcase_10 AC 110 ms
77,840 KB
testcase_11 AC 270 ms
91,652 KB
testcase_12 AC 262 ms
91,812 KB
testcase_13 AC 192 ms
85,292 KB
testcase_14 AC 411 ms
101,344 KB
testcase_15 AC 477 ms
100,344 KB
testcase_16 AC 242 ms
89,820 KB
testcase_17 AC 499 ms
100,284 KB
testcase_18 AC 197 ms
85,288 KB
testcase_19 AC 387 ms
101,248 KB
testcase_20 AC 497 ms
100,592 KB
testcase_21 AC 84 ms
76,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
# -*- coding: utf-8 -*-

# import
from sys import stdin, setrecursionlimit
setrecursionlimit(10**8)

def int_map():
    return map(int,input().split())

def int_list():
    return list(map(int,input().split()))

def int_mtx(N):
    x = [list(map(int, stdin.readline().split())) for _ in range(N)]
    return x

def str_mtx(N):
    x = [list(stdin.readline()[:-1]) for _ in range(N)]
    return x

def print_space(l):
    return print(" ".join([str(x) for x in l]))



"""    main code    """

N = int(input())
a = int_list()

MOD = 998244353

ans = 0
for i in range(N):
    ans += a[i]*pow(2,i,MOD)*(pow(2,N-(i+1),MOD)-1)
    ans %= MOD
    ans -= a[i]*(pow(2,i,MOD)-1)*pow(2,N-(i+1),MOD)
    ans %= MOD

print(ans)
0