結果

問題 No.2396 等差二項展開
ユーザー とりゐとりゐ
提出日時 2023-07-28 22:01:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 298 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 76,972 KB
最終ジャッジ日時 2024-04-16 05:57:09
合計ジャッジ時間 26,119 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,460 KB
testcase_01 AC 42 ms
54,040 KB
testcase_02 AC 40 ms
52,552 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 44 ms
58,256 KB
testcase_06 AC 45 ms
53,440 KB
testcase_07 AC 45 ms
60,096 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 40 ms
53,084 KB
testcase_11 AC 40 ms
53,108 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2,940 ms
76,620 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(a,b):
  c=[0]*L
  for i in range(L):
    for j in range(L):
      c[(i+j)%L]+=a[i]*b[j]
      c[(i+j)%L]%=mod
  return c

N,M,L,K,mod=map(int,input().split())
ans=[0]*L
ans[0]=1
tmp=[0]*L
tmp[0]=1
tmp[1%L]=M

for i in range(60):
  if (N>i)&1:
    ans=f(ans,tmp)
  tmp=f(tmp,tmp)
print(ans[K])
0