結果

問題 No.1310 量子アニーリング
ユーザー wolgnik
提出日時 2020-12-07 21:01:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 81,896 KB
実行使用メモリ 92,724 KB
最終ジャッジ日時 2024-09-17 14:03:19
合計ジャッジ時間 2,378 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
mod = 998244353
res = 0

class Factorial:
  def __init__(self, n, mod):
    self.mod = mod
    self.f = [1]
    for i in range(1, n + 1):
      self.f.append(self.f[-1] * i % mod)
    self.i = [pow(self.f[-1], mod - 2, mod)]
    for i in range(1, n + 1)[: : -1]:
      self.i.append(self.i[-1] * i % mod)
    self.i.reverse()
  def factorial(self, i): return self.f[i]
  def ifactorial(self, i): return self.i[i]
  def combi(self, n, k): return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod
  def permi(self, n, k): return self.f[n] * self.i[n - k] % self.mod

f = Factorial(N, mod)

for i in range(N + 1):
  res += f.combi(N, i) * pow(2, abs(N - 2 * i), mod)
  res %= mod
print(res)
0