結果

問題 No.644 G L C C D M
ユーザー ああいいああいい
提出日時 2022-03-30 22:18:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 366 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 82,524 KB
実行使用メモリ 64,984 KB
最終ジャッジ日時 2024-04-27 11:59:50
合計ジャッジ時間 2,390 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,208 KB
testcase_01 AC 39 ms
52,808 KB
testcase_02 AC 38 ms
53,444 KB
testcase_03 AC 37 ms
52,696 KB
testcase_04 AC 38 ms
52,532 KB
testcase_05 AC 41 ms
53,908 KB
testcase_06 WA -
testcase_07 AC 37 ms
52,204 KB
testcase_08 WA -
testcase_09 AC 38 ms
52,376 KB
testcase_10 AC 38 ms
52,840 KB
testcase_11 WA -
testcase_12 AC 41 ms
58,156 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 37 ms
52,828 KB
testcase_16 AC 37 ms
52,884 KB
testcase_17 AC 38 ms
52,636 KB
testcase_18 AC 39 ms
52,084 KB
testcase_19 AC 37 ms
52,068 KB
testcase_20 AC 38 ms
52,396 KB
testcase_21 AC 38 ms
53,008 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 42 ms
59,096 KB
testcase_26 AC 42 ms
58,488 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
    Sum += ans
print(ans)
0