結果
問題 | No.2396 等差二項展開 |
ユーザー |
![]() |
提出日時 | 2023-07-28 22:21:37 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 381 bytes |
コンパイル時間 | 538 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 73,344 KB |
最終ジャッジ日時 | 2024-10-06 19:31:05 |
合計ジャッジ時間 | 10,024 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 29 WA * 2 |
ソースコード
def f(a,b): c=[0]*L for i in range(L): for j in range(L): if i+j>=L: c[(i+j)%L]+=a[i]*b[j]%mod*M else: c[(i+j)]+=a[i]*b[j]%mod c[(i+j)%L]%=mod return c N,M,L,K,mod=map(int,input().split()) M%=mod ans=[0]*L ans[0]=1 tmp=[0]*L tmp[0]=1 tmp[1%L]+=1 for i in range(60): if (N>>i)&1: ans=f(ans,tmp) tmp=f(tmp,tmp) print(ans[K]%mod)