結果

問題 No.2120 場合の数の下8桁
ユーザー flygonflygon
提出日時 2022-11-04 22:41:16
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 563 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 86,912 KB
実行使用メモリ 245,700 KB
最終ジャッジ日時 2023-09-26 01:11:28
合計ジャッジ時間 4,887 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
78,824 KB
testcase_01 AC 97 ms
71,288 KB
testcase_02 AC 102 ms
71,260 KB
testcase_03 AC 98 ms
71,188 KB
testcase_04 AC 95 ms
71,372 KB
testcase_05 AC 95 ms
71,344 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

m = int(input())
n = int(input())
if n > m:
  print(0)
  exit()
mod = 10**8

def e(n): #O(NloglogN)
  l = [i for i in range(n+1)]
  for i in range(2,n):
    if l[i] == i:
      for p in range(i+i,n+1,i):
        l[p] = i
  return l

p = e(m+10)
from collections import defaultdict
d = defaultdict(int)
for i in range(n):
  now = m-i
  while now != 1:
    d[p[now]] += 1
    now //= p[now]
  i += 1
  while i != 1:
    d[p[i]] -= 1
    i //= p[i]

ans = 1
for k,v in d.items():
  ans *= pow(k,v,mod)
  ans %= mod

ans = str(ans)
print("0"*(8-len(ans)) + ans)



  
0