結果

問題 No.2120 場合の数の下8桁
ユーザー flygonflygon
提出日時 2022-11-04 22:44:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 541 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 237,772 KB
最終ジャッジ日時 2023-09-26 01:14:53
合計ジャッジ時間 4,482 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
75,428 KB
testcase_01 AC 70 ms
70,840 KB
testcase_02 AC 71 ms
70,756 KB
testcase_03 AC 73 ms
70,916 KB
testcase_04 AC 72 ms
70,684 KB
testcase_05 AC 71 ms
70,728 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)
d =[0]*(m+1)
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 enumerate(d):
  if v == 0: continue
  ans *= pow(k,v,mod)
  ans %= mod

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



  
0