結果

問題 No.1281 Cigarette Distribution
ユーザー tanon710tanon710
提出日時 2020-11-07 00:19:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 77,604 KB
最終ジャッジ日時 2023-09-29 19:49:46
合計ジャッジ時間 4,560 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,256 KB
testcase_01 AC 72 ms
71,548 KB
testcase_02 AC 71 ms
71,116 KB
testcase_03 AC 71 ms
71,316 KB
testcase_04 AC 71 ms
71,480 KB
testcase_05 AC 68 ms
71,348 KB
testcase_06 AC 69 ms
71,284 KB
testcase_07 AC 69 ms
71,284 KB
testcase_08 AC 70 ms
71,392 KB
testcase_09 AC 69 ms
71,120 KB
testcase_10 AC 69 ms
71,248 KB
testcase_11 AC 71 ms
71,544 KB
testcase_12 AC 138 ms
77,476 KB
testcase_13 AC 185 ms
77,504 KB
testcase_14 AC 171 ms
77,452 KB
testcase_15 AC 145 ms
77,480 KB
testcase_16 AC 157 ms
77,500 KB
testcase_17 AC 81 ms
75,436 KB
testcase_18 AC 200 ms
77,524 KB
testcase_19 AC 200 ms
77,492 KB
testcase_20 AC 200 ms
77,604 KB
testcase_21 AC 187 ms
77,344 KB
testcase_22 AC 196 ms
77,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

debug=False
def pprint(*s):
    if debug==True:
        print(*s)

mod=10**9+7

n,m=map(int,input().split())
for i in range(1,m+1):
    if 2*i-1>n:
        print(0)
    elif i==1:
        print(n)
    else:
        moves=n-(2*i-1)
        plus=moves//i
        one=1
        two=i-1-moves%i
        three=moves%i
        if moves%i==0:
            print((pow(1+plus,one,mod)*pow(2+plus,two,mod))%mod)
        elif moves%i==i-1:
            print((pow(1+plus,one,mod)*pow(3+plus,three,mod))%mod)
        else:
            print((pow(1+plus,one,mod)*pow(2+plus,two,mod)*pow(3+plus,three,mod))%mod)
        pprint(i,moves,plus,one,two,three)
0