結果

問題 No.2120 場合の数の下8桁
ユーザー googol_S0googol_S0
提出日時 2022-11-04 21:42:54
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 478 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 83,272 KB
最終ジャッジ日時 2023-09-26 00:01:15
合計ジャッジ時間 6,822 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

M=int(input())
N=int(input())
mod=10**8
if M<N:
  print(0)
  exit()
N=min(N,M-N)
c2=0
c5=0
A=1
B=1
for i in range(1,M+1):
  if i<=N:
    while i&1==0:
      i>>=1
      c2-=1
    while i%5==0:
      i//=5
      c5-=1
    B=B*i%mod
  elif M-N<i:
    while i&1==0:
      i>>=1
      c2+=1
    while i%5==0:
      i//=5
      c5+=1
    A=A*i%mod
for i in range(mod):
  if i*B%mod==1:
    B=ia
    break
S=str(A*B*pow(2,c2,mod)*pow(5,c5,mod)%mod)
while len(S)<8:
  S='0'+S
print(S)
0