結果

問題 No.2111 Sum of Diff
コンテスト
ユーザー titan23
提出日時 2022-10-28 21:38:02
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 742 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 135 ms
コンパイル使用メモリ 85,348 KB
実行使用メモリ 111,744 KB
最終ジャッジ日時 2026-03-27 11:06:19
合計ジャッジ時間 2,246 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = lambda: sys.stdin.readline().rstrip()
import math, random
from bisect import bisect_right, bisect_left
from itertools import product, permutations, combinations, combinations_with_replacement 
from collections import deque, defaultdict, Counter
from heapq import heapify, heappush, heappop
from functools import lru_cache, reduce
inf = float('inf')
def error(*args, sep=' ', end='\n'):
  print(*args, sep=sep, end=end, file=sys.stderr)
def ltos(a, f=str, sep=' '):
  return sep.join(map(f, a))
# mod = 1000000007
mod = 998244353
# sys.setrecursionlimit(10**6)

#  -----------------------  #

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

cnt = pow(2, n-1, mod)-1
ans = A[0] * cnt
ans -= A[-1] * cnt
print(ans % mod)
0