結果

問題 No.2120 場合の数の下8桁
ユーザー flygonflygon
提出日時 2022-11-04 22:59:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 552 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 251,416 KB
最終ジャッジ日時 2023-09-26 01:29:30
合計ジャッジ時間 7,215 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,396 KB
testcase_01 AC 74 ms
71,124 KB
testcase_02 AC 75 ms
70,928 KB
testcase_03 AC 73 ms
71,120 KB
testcase_04 AC 74 ms
71,240 KB
testcase_05 AC 72 ms
71,324 KB
testcase_06 AC 797 ms
251,416 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 90 ms
77,632 KB
testcase_10 AC 428 ms
169,304 KB
testcase_11 AC 784 ms
251,280 KB
testcase_12 AC 85 ms
76,572 KB
testcase_13 AC 88 ms
77,896 KB
testcase_14 AC 97 ms
80,124 KB
testcase_15 AC 428 ms
167,772 KB
testcase_16 AC 736 ms
243,200 KB
testcase_17 AC 802 ms
248,476 KB
testcase_18 WA -
testcase_19 AC 822 ms
251,372 KB
権限があれば一括ダウンロードができます

ソースコード

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)]
  x = []
  for i in range(2,n+1):
    if l[i] == i:
      x.append(i)
      for p in range(i+i,n+1,i):
        l[p] = i
  return x

p = e(m)
d =[0]*(m+1)
for pn in p:
  now = pn
  cnt = 0
  while now <= m:
    cnt += m//now-(m-n)//now
    cnt -= n//now
    now *= pn
  d[pn] = cnt
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