結果

問題 No.1310 量子アニーリング
ユーザー 👑 KazunKazun
提出日時 2020-12-07 02:42:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 2,323 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 78,476 KB
最終ジャッジ日時 2023-10-17 15:53:24
合計ジャッジ時間 2,183 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,468 KB
testcase_01 AC 35 ms
53,468 KB
testcase_02 AC 33 ms
53,468 KB
testcase_03 AC 32 ms
53,468 KB
testcase_04 AC 32 ms
53,468 KB
testcase_05 AC 33 ms
53,468 KB
testcase_06 AC 32 ms
53,468 KB
testcase_07 AC 33 ms
53,468 KB
testcase_08 AC 33 ms
53,468 KB
testcase_09 AC 34 ms
53,468 KB
testcase_10 AC 35 ms
53,468 KB
testcase_11 AC 39 ms
59,508 KB
testcase_12 AC 51 ms
64,212 KB
testcase_13 AC 61 ms
69,256 KB
testcase_14 AC 66 ms
70,544 KB
testcase_15 AC 71 ms
73,684 KB
testcase_16 AC 72 ms
73,936 KB
testcase_17 AC 89 ms
78,476 KB
testcase_18 AC 93 ms
75,532 KB
testcase_19 AC 70 ms
71,076 KB
testcase_20 AC 58 ms
66,312 KB
testcase_21 AC 54 ms
65,424 KB
testcase_22 AC 103 ms
75,516 KB
testcase_23 AC 60 ms
69,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def nCr(n,r):
    return (F[n]*G[r]*G[n-r])%Mod
N=int(input())
Mod=998244353

F=[0]*(N+1)
F[0]=1
for i in range(1,N+1):
    F[i]=(i*F[i-1])%Mod

G=[0]*(N+1)
G[N]=pow(F[N],Mod-2,Mod)
for k in range(N-1,-1,-1):
    G[k]=(G[k+1]*(k+1))%Mod

S=0
a=N

while -N<=a<=N:
    k=(a+N)//2
    S+=2*pow(2,abs(a),Mod)*nCr(N,k)
    S%=Mod
    a-=4

print(S)
0