結果
| 問題 |
No.1281 Cigarette Distribution
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-07 00:19:04 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 158 ms / 2,000 ms |
| コード長 | 638 bytes |
| コンパイル時間 | 195 ms |
| コンパイル使用メモリ | 82,268 KB |
| 実行使用メモリ | 76,532 KB |
| 最終ジャッジ日時 | 2024-07-22 13:54:55 |
| 合計ジャッジ時間 | 3,188 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)