結果

問題 No.1281 Cigarette Distribution
ユーザー ibyiby
提出日時 2020-11-16 20:37:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,258 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 8,368 KB
最終ジャッジ日時 2023-09-30 07:27:42
合計ジャッジ時間 10,117 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,824 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 AC 16 ms
7,852 KB
testcase_03 AC 15 ms
7,812 KB
testcase_04 AC 16 ms
7,892 KB
testcase_05 AC 15 ms
7,828 KB
testcase_06 AC 15 ms
7,804 KB
testcase_07 AC 16 ms
7,860 KB
testcase_08 AC 16 ms
7,904 KB
testcase_09 AC 16 ms
7,864 KB
testcase_10 AC 15 ms
7,912 KB
testcase_11 AC 15 ms
7,856 KB
testcase_12 AC 372 ms
7,952 KB
testcase_13 AC 837 ms
8,260 KB
testcase_14 AC 661 ms
7,864 KB
testcase_15 AC 417 ms
8,216 KB
testcase_16 AC 532 ms
8,284 KB
testcase_17 AC 22 ms
7,872 KB
testcase_18 AC 1,258 ms
8,368 KB
testcase_19 AC 1,239 ms
8,284 KB
testcase_20 AC 1,230 ms
8,344 KB
testcase_21 AC 755 ms
7,824 KB
testcase_22 AC 875 ms
8,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

n, m = map(int, input().split())

def inv(x):
    return pow(x, mod-2, mod)


for x in range(1, m+1):
    u, v = divmod(n + 1, x)
    ans = pow(u, x-v, mod)*pow(u+1, v, mod)
    ans *= (u-1)
    ans *= inv(u)
    print(ans % mod)

0