結果

問題 No.1281 Cigarette Distribution
ユーザー 👑 timitimi
提出日時 2020-11-09 09:33:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 524 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 8,616 KB
最終ジャッジ日時 2023-09-29 21:58:24
合計ジャッジ時間 5,873 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,876 KB
testcase_01 AC 15 ms
7,844 KB
testcase_02 AC 14 ms
7,768 KB
testcase_03 AC 14 ms
7,784 KB
testcase_04 AC 15 ms
7,940 KB
testcase_05 AC 14 ms
7,784 KB
testcase_06 AC 15 ms
7,832 KB
testcase_07 AC 14 ms
7,872 KB
testcase_08 AC 15 ms
7,772 KB
testcase_09 AC 15 ms
7,812 KB
testcase_10 AC 15 ms
7,760 KB
testcase_11 AC 15 ms
7,788 KB
testcase_12 AC 229 ms
7,816 KB
testcase_13 AC 427 ms
8,540 KB
testcase_14 AC 393 ms
7,748 KB
testcase_15 AC 216 ms
8,524 KB
testcase_16 AC 281 ms
8,616 KB
testcase_17 AC 18 ms
7,852 KB
testcase_18 AC 524 ms
8,440 KB
testcase_19 AC 522 ms
8,412 KB
testcase_20 AC 521 ms
8,612 KB
testcase_21 AC 458 ms
7,944 KB
testcase_22 AC 471 ms
8,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int, input().split())
mod=10**9+7
for x in range(1,M+1):
  if 2*x-1>N:
    print(0)
  else:
    if x==1:
      print(N)
    elif x==2:
      if N%2==0:
        a,b=(N+2)//2,(N-2)//2
        print(a*b%mod)
      else:
        a,b=(N+1)//2,(N-1)//2
        print(a*b%mod)
    else:     
      a=(N+1)%x
      b=x-a-1
      d=pow((N+1)//x+1,a,mod)*pow((N+1)//x,b,mod)*((N+1)//x-1)
      print(d%mod)
0