結果

問題 No.1281 Cigarette Distribution
ユーザー rlangevinrlangevin
提出日時 2023-02-05 22:07:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 430 ms / 2,000 ms
コード長 395 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2023-09-17 11:56:16
合計ジャッジ時間 7,439 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,144 KB
testcase_01 AC 72 ms
71,344 KB
testcase_02 AC 74 ms
71,232 KB
testcase_03 AC 74 ms
71,120 KB
testcase_04 AC 74 ms
71,348 KB
testcase_05 AC 74 ms
71,144 KB
testcase_06 AC 72 ms
71,360 KB
testcase_07 AC 74 ms
71,176 KB
testcase_08 AC 73 ms
71,008 KB
testcase_09 AC 74 ms
71,032 KB
testcase_10 AC 73 ms
71,336 KB
testcase_11 AC 72 ms
71,364 KB
testcase_12 AC 171 ms
77,116 KB
testcase_13 AC 297 ms
77,196 KB
testcase_14 AC 234 ms
77,172 KB
testcase_15 AC 195 ms
77,276 KB
testcase_16 AC 219 ms
77,548 KB
testcase_17 AC 84 ms
75,232 KB
testcase_18 AC 425 ms
77,164 KB
testcase_19 AC 430 ms
77,268 KB
testcase_20 AC 429 ms
77,568 KB
testcase_21 AC 259 ms
77,216 KB
testcase_22 AC 305 ms
77,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
mod = 10 ** 9 + 7

for i in range(1, M + 1):
    big = N % i
    small = i - big
    ans = pow(N//i, small, mod) * pow(N//i + 1, big, mod)
    if small == 0:
        ans *= pow(N//i + 1, mod - 3, mod)
        ans *= N//i * (N//i + 2)
    elif small >= 2:
        ans *= pow(N//i, mod - 3, mod)
        ans *= (N//i - 1) * (N//i + 1)
    ans %= mod
    print(ans)
0