結果
| 問題 | No.1281 Cigarette Distribution |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-07 00:19:04 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 140 ms / 2,000 ms |
| コード長 | 638 bytes |
| 記録 | |
| コンパイル時間 | 180 ms |
| コンパイル使用メモリ | 85,320 KB |
| 実行使用メモリ | 81,536 KB |
| 最終ジャッジ日時 | 2026-04-03 09:21:41 |
| 合計ジャッジ時間 | 3,257 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
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)