結果

問題 No.1281 Cigarette Distribution
ユーザー trineutron
提出日時 2020-11-21 16:57:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 78,504 KB
最終ジャッジ日時 2024-07-23 15:52:46
合計ジャッジ時間 4,306 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7

def power(n, k):
    if k == 0:
        return 1
    res = 1
    while k:
        if k % 2:
            res = res * n % mod
        n = n * n % mod
        k //= 2
    return res

n, m = map(int, input().split())
for i in range(1, m + 1):
    d, r = divmod(n + 1, i)
    print(power(d+1, r) * power(d, i-r-1) * (d-1) % mod)
0