結果

問題 No.1419 Power Moves
ユーザー 👑 potato167
提出日時 2022-02-17 01:42:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 76,384 KB
最終ジャッジ日時 2024-06-29 07:24:50
合計ジャッジ時間 3,592 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
MOD=10**9+7
R=pow(2,MOD-1-K,MOD)
M=N
if M%2==0:
	M//=2
A=pow(2,K-1,M)+M
A%=M
B=pow(2,K-1,MOD)-A
B*=pow(M,MOD-2,MOD)
B%=MOD
for i in range(N):
	if N%2==0 and i%2==0:
		print(0)
	else:
		D=i+1
		if i==0:
			D=N+1
		E=N-i+1
		if D%2==1:
			D+=N
		if E%2==1:
			E+=N
		D//=2
		E//=2
		#print(M,D,E)
		ans=B*2
		if A>=D:
			ans+=1
		if A>=E:
			ans+=1
		print((ans*R)%MOD)
0