結果

問題 No.644 G L C C D M
ユーザー ああいいああいい
提出日時 2022-03-30 22:18:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 65,800 KB
最終ジャッジ日時 2024-04-27 12:00:58
合計ジャッジ時間 2,196 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,560 KB
testcase_01 AC 42 ms
52,896 KB
testcase_02 AC 45 ms
52,360 KB
testcase_03 AC 37 ms
52,192 KB
testcase_04 AC 38 ms
53,420 KB
testcase_05 AC 38 ms
53,424 KB
testcase_06 WA -
testcase_07 AC 37 ms
53,224 KB
testcase_08 WA -
testcase_09 AC 37 ms
52,156 KB
testcase_10 AC 38 ms
52,552 KB
testcase_11 WA -
testcase_12 AC 41 ms
59,056 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 38 ms
53,500 KB
testcase_16 AC 38 ms
52,492 KB
testcase_17 AC 39 ms
53,828 KB
testcase_18 AC 39 ms
51,952 KB
testcase_19 AC 41 ms
53,012 KB
testcase_20 AC 40 ms
52,368 KB
testcase_21 AC 38 ms
53,320 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 44 ms
59,308 KB
testcase_26 AC 44 ms
60,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())

P = 10 ** 9 + 7

import sys
if N < 2 * M:
    print(0)
    exit()

C = N + 5
fact = [1] * C
for i in range(2,C):
    fact[i] = fact[i-1] * i % P
    
Sum = 0
ans = 0
for i in range(N // M,0,-1):
    m = i * M
    if N < 2 * m:continue
    j = N // m
    tmp = j * (j - 1) * fact[N-2] % P
    ans = tmp - Sum
    ans %= P
    Sum += ans
print(ans)
0