結果

問題 No.1281 Cigarette Distribution
ユーザー 👑 tamatotamato
提出日時 2020-11-06 22:17:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 1,113 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 78,156 KB
最終ジャッジ日時 2023-09-29 18:59:09
合計ジャッジ時間 4,615 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,768 KB
testcase_01 AC 63 ms
71,292 KB
testcase_02 AC 61 ms
71,740 KB
testcase_03 AC 62 ms
71,240 KB
testcase_04 AC 59 ms
71,248 KB
testcase_05 AC 62 ms
71,632 KB
testcase_06 AC 62 ms
71,768 KB
testcase_07 AC 63 ms
71,672 KB
testcase_08 AC 63 ms
71,700 KB
testcase_09 AC 61 ms
71,676 KB
testcase_10 AC 66 ms
71,216 KB
testcase_11 AC 65 ms
71,748 KB
testcase_12 AC 120 ms
77,788 KB
testcase_13 AC 155 ms
78,012 KB
testcase_14 AC 148 ms
77,716 KB
testcase_15 AC 120 ms
77,860 KB
testcase_16 AC 134 ms
77,656 KB
testcase_17 AC 81 ms
77,092 KB
testcase_18 AC 188 ms
78,024 KB
testcase_19 AC 184 ms
78,072 KB
testcase_20 AC 182 ms
78,156 KB
testcase_21 AC 175 ms
77,780 KB
testcase_22 AC 169 ms
78,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N, M = map(int, input().split())
    for m in range(1, M+1):
        if N < m * 2 - 1:
            print(0)
            continue

        if m == 1:
            print(N)
            continue

        ok = 0
        ng = N+1
        mid = (ok+ng) // 2
        while ng - ok > 1:
            if (mid + 1) * m - 1 <= N:
                ok = mid
            else:
                ng = mid
            mid = (ok + ng) // 2
        k = N - ((mid + 1) * m - 1)
        print((ok * pow(ok+1, m - 1 - k, mod) * pow(ok+2, k, mod))%mod)


if __name__ == '__main__':
    main()
0