結果

問題 No.2120 場合の数の下8桁
ユーザー googol_S0googol_S0
提出日時 2022-11-04 21:44:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 476 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 76,856 KB
最終ジャッジ日時 2023-09-26 00:03:59
合計ジャッジ時間 5,184 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,480 KB
testcase_01 AC 67 ms
71,216 KB
testcase_02 AC 370 ms
75,856 KB
testcase_03 AC 231 ms
75,752 KB
testcase_04 AC 124 ms
75,812 KB
testcase_05 AC 67 ms
71,320 KB
testcase_06 AC 98 ms
75,576 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 72 ms
75,568 KB
testcase_10 AC 84 ms
75,608 KB
testcase_11 AC 347 ms
76,040 KB
testcase_12 AC 124 ms
75,792 KB
testcase_13 AC 283 ms
76,276 KB
testcase_14 AC 470 ms
76,304 KB
testcase_15 AC 214 ms
76,280 KB
testcase_16 AC 351 ms
76,252 KB
testcase_17 AC 514 ms
76,288 KB
testcase_18 WA -
testcase_19 AC 295 ms
76,856 KB
権限があれば一括ダウンロードができます

ソースコード

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=i
    break
S=str(A*B*pow(2,c2,mod)*pow(5,c5,mod)%mod)
while len(S)<8:
  S='0'+S
print(S)
0