結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
51,968 KB
testcase_01 AC 46 ms
51,968 KB
testcase_02 AC 45 ms
51,968 KB
testcase_03 WA -
testcase_04 AC 51 ms
59,008 KB
testcase_05 AC 45 ms
52,352 KB
testcase_06 AC 44 ms
52,224 KB
testcase_07 AC 49 ms
59,008 KB
testcase_08 AC 51 ms
59,136 KB
testcase_09 WA -
testcase_10 AC 46 ms
51,712 KB
testcase_11 AC 46 ms
51,968 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 906 ms
75,776 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